Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
dms3
go-datastore
Commits
238411e2
Commit
238411e2
authored
Sep 21, 2014
by
Juan Batiz-Benet
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #4 from perfmode/master
feat(interface) add ThreadsafeDatastore interface
parents
73e92818
3dad2a44
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
8 additions
and
1 deletion
+8
-1
datastore.go
datastore.go
+5
-0
leveldb/datastore.go
leveldb/datastore.go
+3
-1
No files found.
datastore.go
View file @
238411e2
...
@@ -56,6 +56,11 @@ type Datastore interface {
...
@@ -56,6 +56,11 @@ type Datastore interface {
KeyList
()
([]
Key
,
error
)
KeyList
()
([]
Key
,
error
)
}
}
type
ThreadSafeDatastore
interface
{
Datastore
IsThreadSafe
()
}
// Errors
// Errors
// ErrNotFound is returned by Get, Has, and Delete when a datastore does not
// ErrNotFound is returned by Get, Has, and Delete when a datastore does not
...
...
leveldb/datastore.go
View file @
238411e2
...
@@ -13,7 +13,7 @@ type Datastore struct {
...
@@ -13,7 +13,7 @@ type Datastore struct {
type
Options
opt
.
Options
type
Options
opt
.
Options
func
NewDatastore
(
path
string
,
opts
*
Options
)
(
*
Datastore
,
error
)
{
func
NewDatastore
(
path
string
,
opts
*
Options
)
(
ds
.
ThreadSafe
Datastore
,
error
)
{
var
nopts
opt
.
Options
var
nopts
opt
.
Options
if
opts
!=
nil
{
if
opts
!=
nil
{
nopts
=
opt
.
Options
(
*
opts
)
nopts
=
opt
.
Options
(
*
opts
)
...
@@ -76,3 +76,5 @@ func (d *Datastore) KeyList() ([]ds.Key, error) {
...
@@ -76,3 +76,5 @@ func (d *Datastore) KeyList() ([]ds.Key, error) {
func
(
d
*
Datastore
)
Close
()
(
err
error
)
{
func
(
d
*
Datastore
)
Close
()
(
err
error
)
{
return
d
.
DB
.
Close
()
return
d
.
DB
.
Close
()
}
}
func
(
d
*
Datastore
)
IsThreadSafe
()
{}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment