MCPcopy
hub / github.com/benbjohnson/litestream / NewStore

Function NewStore

store.go:138–165  ·  view source on GitHub ↗
(dbs []*DB, levels CompactionLevels)

Source from the content-addressed store, hash-verified

136}
137
138func NewStore(dbs []*DB, levels CompactionLevels) *Store {
139 s := &Store{
140 dbs: dbs,
141 levels: levels,
142
143 SnapshotInterval: DefaultSnapshotInterval,
144 SnapshotRetention: DefaultSnapshotRetention,
145 L0Retention: DefaultL0Retention,
146 L0RetentionCheckInterval: DefaultL0RetentionCheckInterval,
147 CompactionMonitorEnabled: true,
148 RetentionEnabled: true,
149 ShutdownSyncTimeout: DefaultShutdownSyncTimeout,
150 ShutdownSyncInterval: DefaultShutdownSyncInterval,
151 HeartbeatCheckInterval: DefaultHeartbeatCheckInterval,
152 Logger: slog.Default().With(LogKeySystem, LogSystemStore),
153 }
154
155 for _, db := range dbs {
156 db.SetLogger(s.Logger.With(LogKeyDB, filepath.Base(db.Path())))
157 db.L0Retention = s.L0Retention
158 db.ShutdownSyncTimeout = s.ShutdownSyncTimeout
159 db.ShutdownSyncInterval = s.ShutdownSyncInterval
160 db.VerifyCompaction = s.VerifyCompaction
161 db.RetentionEnabled = s.RetentionEnabled
162 }
163 s.ctx, s.cancel = context.WithCancel(context.Background())
164 return s
165}
166
167func (s *Store) Open(ctx context.Context) error {
168 if err := s.levels.Validate(); err != nil {

Callers 15

TestServer_HandleInfoFunction · 0.92
TestServer_HandleListFunction · 0.92
TestServer_HandleStartFunction · 0.92
TestServer_HandleStopFunction · 0.92
TestServer_HandleSyncFunction · 0.92
TestStore_CompactDBFunction · 0.92
TestStore_IntegrationFunction · 0.92

Calls 2

SetLoggerMethod · 0.65
PathMethod · 0.45

Tested by 15

TestServer_HandleInfoFunction · 0.74
TestServer_HandleListFunction · 0.74
TestServer_HandleStartFunction · 0.74
TestServer_HandleStopFunction · 0.74
TestServer_HandleSyncFunction · 0.74
TestStore_CompactDBFunction · 0.74
TestStore_IntegrationFunction · 0.74