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
603f4f18
Commit
603f4f18
authored
Aug 07, 2018
by
Cole Brown
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Rename Rollback to Discard, document Txn
parent
825f4be8
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
2 deletions
+14
-2
datastore.go
datastore.go
+14
-2
No files found.
datastore.go
View file @
603f4f18
...
...
@@ -140,12 +140,24 @@ type TTLDatastore interface {
SetTTL
(
key
Key
,
ttl
time
.
Duration
)
error
}
// Txn is an interface for transactions that can be committed or
rolled back
.
// Txn is an interface for transactions that can be committed or
discarded
.
type
Txn
interface
{
// Txn extends the Datastore type. Txns allow users to batch queries and
// mutations to the Datastore into atomic groups, or transactions. Actions
// performed on a transaction will not take hold until a successful call to
// Commit has been made. Likewise, transactions can be aborted by calling
// Discard before a successful Commit has been made.
Datastore
// Commit finalizes a transaction, attempting to commit it to the Datastore.
// May return an error if the transaction has gone stale. The presence of an
// error is an indication that the data was not committed to the Datastore.
Commit
()
error
Rollback
()
// Discard throws away changes recorded in a transaction without committing
// them to the underlying Datastore. Any calls made to Discard after Commit
// has been successfully called will have no effect on the transaction and
// state of the Datastore, making it safe to defer.
Discard
()
}
// TxDatastore is an interface that should be implemented by datastores that
...
...
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