{"modulePath":"github.com/kcp-dev/api-syncagent","version":"v0.9.0","isLatest":true,"isStandardLibrary":false,"goos":"all","goarch":"all","docs":"# package sync\n\n## Functions\n\n```go\nfunc OwnedBy(obj ctrlruntimeclient.Object, agentName string) bool\n```\n\n```go\nfunc RemoteNameForLocalObject(localObj ctrlruntimeclient.Object) *mcreconcile.Request\n```\n\n```go\nfunc WithClusterName(ctx context.Context, cluster logicalcluster.Name) context.Context\n```\n\n```go\nfunc WithEventRecorder(ctx context.Context, recorder record.EventRecorder) context.Context\n```\nWithEventRecorder adds a event recorder to the context. The recorder must be configured for the kcp side of the synchronization as the agent never issues events on the local cluster.\n\n```go\nfunc WithWorkspacePath(ctx context.Context, path logicalcluster.Path) context.Context\n```\n\n## Types\n\n```go\ntype MutatorCreatorFunc func(*syncagentv1alpha1.ResourceMutationSpec) (mutation.Mutator, error)\n```\n\n```go\ntype ObjectStateStore interface {\n\tGet(ctx context.Context, source syncSide) (*unstructured.Unstructured, error)\n\tPut(ctx context.Context, obj *unstructured.Unstructured, clusterName logicalcluster.Name, subresources []string) error\n}\n```\n\n```go\ntype ResourceSyncer struct {\n\t// contains filtered or unexported fields\n}\n```\n\n```go\nfunc NewResourceSyncer(\n\tlog *zap.SugaredLogger,\n\tlocalClient ctrlruntimeclient.Client,\n\tremoteClient ctrlruntimeclient.Client,\n\tpubRes *syncagentv1alpha1.PublishedResource,\n\tlocalCRD *apiextensionsv1.CustomResourceDefinition,\n\tmutatorCreator MutatorCreatorFunc,\n\tstateNamespace string,\n\tagentName string,\n\topts ...ResourceSyncerOption,\n) (*ResourceSyncer, error)\n```\n\n```go\nfunc (s *ResourceSyncer) Process(ctx context.Context, remoteObj *unstructured.Unstructured) (requeue bool, err error)\n```\nProcess is the primary entrypoint for object synchronization. This function will create/update the local primary object (i.e. the copy of the remote object), sync any local status back to the remote object and then also synchronize all related resources. It also handles object deletion and will clean up the local objects when a remote object is gone. Each of these steps can potentially end the current processing and return (true, nil). In this case, the caller should re-fetch the remote object and call Process() again (most likely in the next reconciliation). Only when (false, nil) is returned is the entire process finished. The context must contain a cluster name and event recorder, optionally a workspace path.\n\n```go\ntype ResourceSyncerOption func(*ResourceSyncer)\n```\nResourceSyncerOption configures a ResourceSyncer at construction time.\n\n```go\nfunc WithLiveReaders(local, remote ctrlruntimeclient.Reader) ResourceSyncerOption\n```\nWithLiveReaders configures uncached readers for the local (service cluster) and remote (kcp) sides. They let a MatchOrigin prune re-confirm an empty origin resolution against the API server before deleting all copies of a related resource, guarding against a stale/relisting informer cache. Either reader may be nil.\n\n```go\nfunc WithServerSideApply() ResourceSyncerOption\n```\n\n","path":"github.com/kcp-dev/api-syncagent/internal/sync","name":"sync","synopsis":"","isRedistributable":true}
