{"modulePath":"github.com/cloudquery/plugin-sdk/v4","version":"v4.100.2","isLatest":true,"isStandardLibrary":false,"goos":"all","goarch":"all","docs":"# package state\n\n## Variables\n\n```go\nvar ErrSyncAborted = checkpoint.ErrSyncAborted\n```\nErrSyncAborted is returned by Flush when the sync was cancelled before the state could be sent as a checkpoint. The state stays pending.\n\n## Types\n\n```go\ntype Client interface {\n\tSetKey(ctx context.Context, key string, value string) error\n\tGetKey(ctx context.Context, key string) (string, error)\n\tFlush(ctx context.Context) error\n\tClose() error\n}\n```\n\n```go\nfunc NewClient(ctx context.Context, conn *grpc.ClientConn, tableName string) (Client, error)\n```\n\n```go\nfunc NewClientWithOptions(ctx context.Context, conn *grpc.ClientConn, tableName string, opts ClientOptions) (Client, error)\n```\nNewClientWithOptions returns a client of the state backend at conn. It returns an error if opts sets Checkpoints, as only NewConnectedClientWithOptions gets the backend options that say whether the CLI persists checkpoints.\n\n```go\nfunc NewConnectedClient(ctx context.Context, backendOpts *plugin.BackendOptions) (Client, error)\n```\nNewConnectedClient returns a state client and initialises the gRPC connection to the state backend with a 100MiB max message size. The state client is guaranteed to be non-nil (it defaults to the NoOpClient). You must call Close() on the returned Client object.\n\n```go\nfunc NewConnectedClientWithOptions(ctx context.Context, backendOpts *plugin.BackendOptions, connOpts ConnectionOptions, clOpts ClientOptions) (Client, error)\n```\nNewConnectedClientWithOptions returns a state client and initialises the gRPC connection to the state backend. The state client is guaranteed to be non-nil (it defaults to the NoOpClient). You must call Close() on the returned Client object.\n\n```go\ntype ClientOptions struct {\n\t// Checkpoints is the res channel of the plugin's Sync, the same one passed to the scheduler.\n\t// When the CLI supports checkpoints, Flush sends state on it instead of writing to the backend, and the CLI persists\n\t// the state once the destinations commit the resources synced before it. Changes made within a table resolver (using\n\t// its ctx) wait only for the resources that resolver produced; other changes must be flushed after the resources\n\t// they summarize are sent, e.g. once the scheduler's Sync returns. With StrategyShuffleQueue, queue workers resolve\n\t// relations on other goroutines, so changes made within table resolvers are held until the scheduler's Sync\n\t// completes.\n\t// Only NewConnectedClientWithOptions uses it, as only the backend options say whether the CLI supports checkpoints.\n\tCheckpoints chan\u003c- message.SyncMessage\n}\n```\n\n```go\ntype ConnectionOptions struct {\n\tMaxMsgSizeInBytes int\n}\n```\n\n```go\ntype NoOpClient struct{}\n```\n\n```go\nfunc (*NoOpClient) Close() error\n```\n\n```go\nfunc (*NoOpClient) Flush(_ context.Context) error\n```\n\n```go\nfunc (*NoOpClient) GetKey(_ context.Context, _ string) (string, error)\n```\n\n```go\nfunc (*NoOpClient) SetKey(_ context.Context, _ string, _ string) error\n```\n\n","path":"github.com/cloudquery/plugin-sdk/v4/state","name":"state","synopsis":"","isRedistributable":true}
