{"modulePath":"github.com/cruxstack/github-ops-app","version":"v1.1.0","isLatest":true,"isStandardLibrary":false,"goos":"all","goarch":"all","docs":"# package state\n\nPackage state keeps small records that must outlive a run, such as what each report last posted and when, in memory, in a file, or in AWS SSM Parameter Store.\n\n## Types\n\n```go\ntype File struct {\n\t// contains filtered or unexported fields\n}\n```\nFile keeps records in one JSON file. Writes replace the file atomically. It is for a single process; separate processes sharing the file can lose each other's writes.\n\n```go\nfunc NewFile(path string) *File\n```\nNewFile creates a store that keeps records in the file at path. The file and its directory are created on the first write.\n\n```go\nfunc (f *File) Get(_ context.Context, key string) ([]byte, error)\n```\nGet returns the record stored under key, or nil.\n\n```go\nfunc (f *File) Put(_ context.Context, key string, value []byte) error\n```\nPut stores a record under key.\n\n```go\ntype Memory struct {\n\t// contains filtered or unexported fields\n}\n```\nMemory keeps records in memory, so they are lost when the process exits.\n\n```go\nfunc NewMemory() *Memory\n```\nNewMemory creates an empty Memory store.\n\n```go\nfunc (m *Memory) Get(_ context.Context, key string) ([]byte, error)\n```\nGet returns the record stored under key, or nil.\n\n```go\nfunc (m *Memory) Put(_ context.Context, key string, value []byte) error\n```\nPut stores a record under key.\n\n```go\ntype SSM struct {\n\t// contains filtered or unexported fields\n}\n```\nSSM keeps each record in a String parameter named prefix + key. Records are not secret, so they are not encrypted.\n\n```go\nfunc NewSSM(ctx context.Context, prefix string, client SSMClient) (*SSM, error)\n```\nNewSSM creates a store that keeps records under prefix, a path that starts and ends with a slash, such as /github-ops-app/state/. A nil client is created from the default AWS configuration, which makes no network calls.\n\n```go\nfunc (s *SSM) Get(ctx context.Context, key string) ([]byte, error)\n```\nGet returns the record stored under key, or nil.\n\n```go\nfunc (s *SSM) Put(ctx context.Context, key string, value []byte) error\n```\nPut stores a record under key.\n\n```go\ntype SSMClient interface {\n\tGetParameter(ctx context.Context, in *ssm.GetParameterInput, opts ...func(*ssm.Options)) (*ssm.GetParameterOutput, error)\n\tPutParameter(ctx context.Context, in *ssm.PutParameterInput, opts ...func(*ssm.Options)) (*ssm.PutParameterOutput, error)\n}\n```\nSSMClient is the part of the SSM API the SSM store uses.\n\n","path":"github.com/cruxstack/github-ops-app/internal/state","name":"state","synopsis":"Package state keeps small records that must outlive a run, such as what each report last posted and when, in memory, in a file, or in AWS SSM Parameter Store.","isRedistributable":true}
