github.com/voedger/voedger@v0.0.0-20240520144910-273e84102129/pkg/state/impl_sync_actualizer_state.go (about) 1 /* 2 * Copyright (c) 2022-present unTill Pro, Ltd. 3 */ 4 5 package state 6 7 import ( 8 "context" 9 10 "github.com/voedger/voedger/pkg/isecrets" 11 "github.com/voedger/voedger/pkg/istructs" 12 ) 13 14 type syncActualizerState struct { 15 *hostState 16 eventFunc PLogEventFunc 17 } 18 19 func (s *syncActualizerState) PLogEvent() istructs.IPLogEvent { 20 return s.eventFunc() 21 } 22 23 func implProvideSyncActualizerState(ctx context.Context, appStructsFunc AppStructsFunc, partitionIDFunc PartitionIDFunc, 24 wsidFunc WSIDFunc, n10nFunc N10nFunc, secretReader isecrets.ISecretReader, eventFunc PLogEventFunc, intentsLimit int) IHostState { 25 hs := &syncActualizerState{ 26 hostState: newHostState("SyncActualizer", intentsLimit, appStructsFunc), 27 eventFunc: eventFunc, 28 } 29 hs.addStorage(View, newViewRecordsStorage(ctx, appStructsFunc, wsidFunc, n10nFunc), S_GET|S_GET_BATCH|S_INSERT|S_UPDATE) 30 hs.addStorage(Record, newRecordsStorage(appStructsFunc, wsidFunc, nil), S_GET|S_GET_BATCH) 31 hs.addStorage(WLog, &wLogStorage{ 32 ctx: ctx, 33 eventsFunc: func() istructs.IEvents { return appStructsFunc().Events() }, 34 wsidFunc: wsidFunc, 35 }, S_GET) 36 hs.addStorage(AppSecret, &appSecretsStorage{secretReader: secretReader}, S_GET) 37 return hs 38 }