Files
micromdm/platform/dep/sync/syncnow.go
Victor Vrantchan 93fb332b84 Depsync cleanup (#505)
Closes #302

This package still needs a lot of work, but I feel like this is a good stopping point.
In a follow up, I plan on writing some tests, and refactoring some of the ways the sync.Watcher goroutines are managed.
2018-09-11 02:01:25 +00:00

41 lines
857 B
Go

package sync
import (
"context"
"net/http"
"github.com/go-kit/kit/endpoint"
)
func (s *DEPSyncService) SyncNow(_ context.Context) error {
s.syncer.SyncNow()
return nil
}
type syncNowResponse struct{}
type syncNowRequest struct{}
func MakeSyncNowEndpoint(s Service) endpoint.Endpoint {
return func(ctx context.Context, _ interface{}) (interface{}, error) {
s.SyncNow(ctx)
return syncNowResponse{}, nil
}
}
func decodeEmptyRequest(ctx context.Context, r *http.Request) (interface{}, error) {
return nil, nil
}
func encodeEmptyResponse(ctx context.Context, w http.ResponseWriter, response interface{}) error {
return nil
}
func decodeEmptyResponse(ctx context.Context, r *http.Response) (interface{}, error) {
return nil, nil
}
func (e Endpoints) SyncNow(ctx context.Context) error {
_, err := e.SyncNowEndpoint(ctx, nil)
return err
}