package state import ( "context" "time" "github.com/google/uuid" "code.icb4dc0.de/buildr/buildr/modules/state/ent" ) type Metadata struct { ModifiedAt time.Time TTL *time.Time } type Key interface { Bytes() []byte } type EntryOption interface { applyToEntry(e *ent.KVEntryCreate) } type Store interface { StoreWriter StoreReader } type StoreWriter interface { Set(ctx context.Context, key Key, state []byte, opts ...EntryOption) error } type StoreReader interface { Get(ctx context.Context, key Key) (state []byte, meta Metadata, err error) } type CacheWriter interface { Set(ctx context.Context, key Key, state []byte) error } type Cache interface { CacheWriter StoreReader } type Plugins interface { List(ctx context.Context) ([]Plugin, error) Remove(ctx context.Context, id uuid.UUID) error ModulesForPlugin(ctx context.Context, id uuid.UUID) ([]PluginModule, error) UpsertPlugin(ctx context.Context, plugin Plugin) (pluginID uuid.UUID, err error) UpsertModules(ctx context.Context, modules []PluginModule) error }