Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions kvs.go
Original file line number Diff line number Diff line change
Expand Up @@ -99,4 +99,9 @@ func (ps *SwarmKvs) Delete(ctx context.Context, key []byte) error {
}
return nil
}

Comment thread
zelig marked this conversation as resolved.
Outdated
// Close stops the mutex
Comment thread
zelig marked this conversation as resolved.
Outdated
func (ps *SwarmKvs) Close() error {
return ps.idx.Close()
}

13 changes: 13 additions & 0 deletions kvs_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -134,4 +134,17 @@ func TestPotKvs_Save(t *testing.T) {
assert.NoError(t, err)
assert.Equal(t, val2, val)
})
t.Run("Create KVS, write to it, close it", func(t *testing.T) {
ls := createLs()
kvs1, _ := pot.NewSwarmKvs(ls)

err := kvs1.Put(ctx, key1, val1)
assert.NoError(t, err)

_, err = kvs1.Save(ctx)
assert.NoError(t, err)

err = kvs1.Close()
assert.NoError(t, err)
})
Comment thread
zelig marked this conversation as resolved.
Outdated
}
Loading