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-ds-flatfs
Commits
13484edf
Commit
13484edf
authored
Jun 26, 2015
by
Jeromy
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
rename Transaction to Batch
parent
91189388
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
6 deletions
+6
-6
flatfs.go
flatfs.go
+6
-6
No files found.
flatfs.go
View file @
13484edf
...
@@ -323,32 +323,32 @@ func (fs *Datastore) enumerateKeys(fi os.FileInfo, res []query.Entry) ([]query.E
...
@@ -323,32 +323,32 @@ func (fs *Datastore) enumerateKeys(fi os.FileInfo, res []query.Entry) ([]query.E
return
res
,
nil
return
res
,
nil
}
}
type
flatfs
Transaction
struct
{
type
flatfs
Batch
struct
{
puts
map
[
datastore
.
Key
]
interface
{}
puts
map
[
datastore
.
Key
]
interface
{}
deletes
map
[
datastore
.
Key
]
struct
{}
deletes
map
[
datastore
.
Key
]
struct
{}
ds
*
Datastore
ds
*
Datastore
}
}
func
(
fs
*
Datastore
)
Start
Batch
Op
()
datastore
.
Transaction
{
func
(
fs
*
Datastore
)
Batch
()
datastore
.
Batch
{
return
&
flatfs
Transaction
{
return
&
flatfs
Batch
{
puts
:
make
(
map
[
datastore
.
Key
]
interface
{}),
puts
:
make
(
map
[
datastore
.
Key
]
interface
{}),
deletes
:
make
(
map
[
datastore
.
Key
]
struct
{}),
deletes
:
make
(
map
[
datastore
.
Key
]
struct
{}),
ds
:
fs
,
ds
:
fs
,
}
}
}
}
func
(
bt
*
flatfs
Transaction
)
Put
(
key
datastore
.
Key
,
val
interface
{})
error
{
func
(
bt
*
flatfs
Batch
)
Put
(
key
datastore
.
Key
,
val
interface
{})
error
{
bt
.
puts
[
key
]
=
val
bt
.
puts
[
key
]
=
val
return
nil
return
nil
}
}
func
(
bt
*
flatfs
Transaction
)
Delete
(
key
datastore
.
Key
)
error
{
func
(
bt
*
flatfs
Batch
)
Delete
(
key
datastore
.
Key
)
error
{
bt
.
deletes
[
key
]
=
struct
{}{}
bt
.
deletes
[
key
]
=
struct
{}{}
return
nil
return
nil
}
}
func
(
bt
*
flatfs
Transaction
)
Commit
()
error
{
func
(
bt
*
flatfs
Batch
)
Commit
()
error
{
if
err
:=
bt
.
ds
.
putMany
(
bt
.
puts
);
err
!=
nil
{
if
err
:=
bt
.
ds
.
putMany
(
bt
.
puts
);
err
!=
nil
{
return
err
return
err
}
}
...
...
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