[DEPRECATED] Go implementation of plcbundle
at main 43 lines 1.3 kB view raw
1package didindex 2 3import ( 4 "context" 5 "time" 6 7 "tangled.org/atscan.net/plcbundle-go/internal/plcclient" 8) 9 10// BundleProvider is an interface to avoid circular dependencies 11// The bundle.Manager implements this interface 12type BundleProvider interface { 13 LoadBundleForDIDIndex(ctx context.Context, bundleNumber int) (*BundleData, error) 14 LoadOperation(ctx context.Context, bundleNumber int, position int) (*plcclient.PLCOperation, error) 15 LoadOperations(ctx context.Context, bundleNumber int, positions []int) (map[int]*plcclient.PLCOperation, error) 16 GetBundleIndex() BundleIndexProvider 17} 18 19// BundleData contains the minimal bundle information needed by DID index 20type BundleData struct { 21 BundleNumber int 22 Operations []plcclient.PLCOperation 23} 24 25// BundleIndexProvider provides access to bundle metadata 26type BundleIndexProvider interface { 27 GetBundles() []*BundleMetadata 28 GetBundle(bundleNumber int) (*BundleMetadata, error) 29 GetLastBundle() *BundleMetadata 30} 31 32// BundleMetadata is the minimal metadata needed by DID index 33type BundleMetadata struct { 34 BundleNumber int 35 StartTime time.Time 36 EndTime time.Time 37} 38 39// Logger interface (shared) 40type Logger interface { 41 Printf(format string, v ...interface{}) 42 Println(v ...interface{}) 43}