Merge pull request '[agent/codex:gpt-5.4-mini] Read ~/spec/code/core/go/store/RFC.md fully. Find ONE featur...' (#100) from agent/read---spec-code-core-go-store-rfc-md-fu into dev
Some checks are pending
Security Scan / security (push) Waiting to run
Test / test (push) Waiting to run

This commit is contained in:
Virgil 2026-04-04 08:33:13 +00:00
commit 7a571f1958
2 changed files with 22 additions and 0 deletions

View file

@ -147,6 +147,18 @@ func (storeInstance *Store) DatabasePath() string {
return storeInstance.databasePath
}
// Usage example: `if storeInstance.IsClosed() { return }`
func (storeInstance *Store) IsClosed() bool {
if storeInstance == nil {
return true
}
storeInstance.closeLock.Lock()
closed := storeInstance.closed
storeInstance.closeLock.Unlock()
return closed
}
// Usage example: `storeInstance, err := store.New(":memory:", store.WithPurgeInterval(20*time.Millisecond))`
func WithPurgeInterval(interval time.Duration) StoreOption {
return func(config *StoreConfig) {

View file

@ -155,6 +155,16 @@ func TestStore_DatabasePath_Good(t *testing.T) {
assert.Equal(t, databasePath, storeInstance.DatabasePath())
}
func TestStore_IsClosed_Good(t *testing.T) {
storeInstance, err := New(":memory:")
require.NoError(t, err)
assert.False(t, storeInstance.IsClosed())
require.NoError(t, storeInstance.Close())
assert.True(t, storeInstance.IsClosed())
assert.True(t, (*Store)(nil).IsClosed())
}
func TestStore_NewConfigured_Good(t *testing.T) {
storeInstance, err := NewConfigured(StoreConfig{
DatabasePath: ":memory:",