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

Method Close

store.go:236–258  ·  view source on GitHub ↗
(ctx context.Context)

Source from the content-addressed store, hash-verified

234}
235
236func (s *Store) Close(ctx context.Context) (err error) {
237 s.mu.Lock()
238 dbs := slices.Clone(s.dbs)
239 s.mu.Unlock()
240
241 for _, db := range dbs {
242 if e := db.Close(ctx); e != nil {
243 if errors.Is(e, ErrShutdownInterrupted) {
244 if err == nil {
245 err = e
246 }
247 } else if err == nil || errors.Is(err, ErrShutdownInterrupted) {
248 err = e
249 }
250 }
251 }
252
253 // Cancel and wait for background tasks to complete.
254 s.cancel()
255 s.wg.Wait()
256
257 return err
258}
259
260func (s *Store) DBs() []*DB {
261 s.mu.Lock()

Callers 15

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

Calls 3

IsMethod · 0.80
LockMethod · 0.45
UnlockMethod · 0.45

Tested by 15

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