@@ -21,39 +21,32 @@ import (
2121 "github.com/sdcio/sdc-protos/tree_persist"
2222)
2323
24- // IntentReader reads real Intents. Every backend implements this directly —
25- // it's the one capability every Cache.Type genuinely has data for.
24+ // IntentReader reads real Intents. Every cache backend implements it.
2625type IntentReader interface {
2726 InstanceIntentsList (ctx context.Context , cacheInstanceName string ) ([]string , error )
2827 InstanceIntentGet (ctx context.Context , cacheName string , intentName string ) (importer.IntentAdapter , error )
2928 InstanceIntentExists (ctx context.Context , cacheName string , intentName string ) (bool , error )
3029 InstanceIntentGetAll (ctx context.Context , cacheName string , excludeIntentNames []string , intentChan chan <- importer.IntentAdapter , errChan chan <- error )
3130}
3231
33- // IntentWriter persists real Intents. Backends that don't own real-Intent
34- // writes (e.g. config-server, where kube-api owns them) compose a no-op
35- // implementation instead of implementing this directly, so the type system
36- // makes that lack of ownership visible.
32+ // IntentWriter persists real Intents. A backend that does not own those
33+ // writes (config-server: kube-api writes them) composes noopIntentWriter.
3734type IntentWriter interface {
3835 InstanceIntentModify (ctx context.Context , cacheName string , intent * tree_persist.Intent ) error
3936 InstanceIntentDelete (ctx context.Context , cacheName string , intentName string , IgnoreNonExisting bool ) error
4037}
4138
42- // RunningStore reads/writes "running": split out of the generic Intent
43- // surface, independent of Cache.Type. LocalCache keeps its existing
44- // disk-backed store for it (unchanged on-disk behavior); other backends may
45- // back it however they see fit (e.g. purely in-memory), since it's never
46- // config-server's data to begin with.
39+ // RunningStore reads and writes "running", the synced device-state intent.
40+ // It is independent of Cache.Type: LocalCache keeps it on disk; other
41+ // backends may keep it in memory.
4742type RunningStore interface {
4843 InstanceRunningGet (ctx context.Context , cacheName string ) (importer.ImportConfigAdapter , error )
4944 InstanceRunningModify (ctx context.Context , cacheName string , intent * tree_persist.Intent ) error
5045}
5146
52- // InstanceLifecycle creates/destroys/enumerates cache instances. Under
53- // ConfigServerCache this only ever governs its in-memory running store — it
54- // has no relationship to whether real-Intent data exists for a target under
55- // that backend, unlike LocalCache where it governs the one shared disk store
56- // underlying everything.
47+ // InstanceLifecycle creates, closes, and enumerates cache instances.
48+ // On a config-server backend this covers only the in-memory running store,
49+ // not whether real Intent data exists for a target.
5750type InstanceLifecycle interface {
5851 InstanceCreate (ctx context.Context , cacheInstanceName string ) error
5952 InstanceDelete (ctx context.Context , cacheInstanceName string ) error
@@ -62,6 +55,8 @@ type InstanceLifecycle interface {
6255 InstancesList (ctx context.Context ) []string
6356}
6457
58+ // Client is a full cache backend: intent read and write, running, and
59+ // instance lifecycle.
6560type Client interface {
6661 IntentReader
6762 IntentWriter
0 commit comments