[agent/codex:gpt-5.4-mini] Read ~/spec/code/core/go/store/RFC.md fully. Find features d... #117
2 changed files with 12 additions and 8 deletions
4
store.go
4
store.go
|
|
@ -29,7 +29,8 @@ const (
|
|||
|
||||
// Usage example: `storeOptions := []store.StoreOption{store.WithJournal("http://127.0.0.1:8086", "core", "events")}`
|
||||
// Prefer `store.NewConfigured(store.StoreConfig{...})` when the configuration
|
||||
// is already known as a struct literal.
|
||||
// is already known as a struct literal. Use `StoreOption` only when the values
|
||||
// need to be assembled incrementally.
|
||||
type StoreOption func(*StoreConfig)
|
||||
|
||||
// Usage example: `config := store.StoreConfig{DatabasePath: ":memory:", PurgeInterval: 30 * time.Second}`
|
||||
|
|
@ -43,6 +44,7 @@ type StoreConfig struct {
|
|||
}
|
||||
|
||||
// Usage example: `config := storeInstance.JournalConfiguration(); fmt.Println(config.EndpointURL, config.Organisation, config.BucketName)`
|
||||
// The values are copied into the store and used as journal metadata.
|
||||
type JournalConfiguration struct {
|
||||
// Usage example: `config := store.JournalConfiguration{EndpointURL: "http://127.0.0.1:8086"}`
|
||||
EndpointURL string
|
||||
|
|
|
|||
16
workspace.go
16
workspace.go
|
|
@ -67,6 +67,7 @@ func (workspace *Workspace) DatabasePath() string {
|
|||
|
||||
// Close leaves the SQLite workspace file `.core/state/scroll-session-2026-03-30.duckdb`
|
||||
// on disk so a later store instance can recover it as an orphan.
|
||||
// Call `Discard()` afterwards if you decide the file should be removed.
|
||||
//
|
||||
// Usage example: `if err := workspace.Close(); err != nil { return }; orphans := storeInstance.RecoverOrphans(".core/state"); _ = orphans`
|
||||
func (workspace *Workspace) Close() error {
|
||||
|
|
@ -417,15 +418,16 @@ func (workspace *Workspace) closeAndCleanup(removeFiles bool) error {
|
|||
}
|
||||
|
||||
workspace.closeLock.Lock()
|
||||
defer workspace.closeLock.Unlock()
|
||||
|
||||
if workspace.closed {
|
||||
return nil
|
||||
alreadyClosed := workspace.closed
|
||||
if !alreadyClosed {
|
||||
workspace.closed = true
|
||||
}
|
||||
workspace.closed = true
|
||||
workspace.closeLock.Unlock()
|
||||
|
||||
if err := workspace.workspaceDatabase.Close(); err != nil {
|
||||
return core.E("store.Workspace.closeAndRemoveFiles", "close workspace database", err)
|
||||
if !alreadyClosed {
|
||||
if err := workspace.workspaceDatabase.Close(); err != nil {
|
||||
return core.E("store.Workspace.closeAndRemoveFiles", "close workspace database", err)
|
||||
}
|
||||
}
|
||||
if !removeFiles {
|
||||
return nil
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue