First split into crockery init
and crockery run
The init command creates a crockery.db file containing the domain name and TLS keypair. The run command starts IMAP and SMTP services based on that file. Supporting only a single domain is starting to look a bit unnecessary. We'll see how that goes.
This commit is contained in:
52
vendor/github.com/asdine/storm/transaction.go
generated
vendored
Normal file
52
vendor/github.com/asdine/storm/transaction.go
generated
vendored
Normal file
@@ -0,0 +1,52 @@
|
||||
package storm
|
||||
|
||||
import "github.com/coreos/bbolt"
|
||||
|
||||
// Tx is a transaction.
|
||||
type Tx interface {
|
||||
// Commit writes all changes to disk.
|
||||
Commit() error
|
||||
|
||||
// Rollback closes the transaction and ignores all previous updates.
|
||||
Rollback() error
|
||||
}
|
||||
|
||||
// Begin starts a new transaction.
|
||||
func (n node) Begin(writable bool) (Node, error) {
|
||||
var err error
|
||||
|
||||
n.tx, err = n.s.Bolt.Begin(writable)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return &n, nil
|
||||
}
|
||||
|
||||
// Rollback closes the transaction and ignores all previous updates.
|
||||
func (n *node) Rollback() error {
|
||||
if n.tx == nil {
|
||||
return ErrNotInTransaction
|
||||
}
|
||||
|
||||
err := n.tx.Rollback()
|
||||
if err == bolt.ErrTxClosed {
|
||||
return ErrNotInTransaction
|
||||
}
|
||||
|
||||
return err
|
||||
}
|
||||
|
||||
// Commit writes all changes to disk.
|
||||
func (n *node) Commit() error {
|
||||
if n.tx == nil {
|
||||
return ErrNotInTransaction
|
||||
}
|
||||
|
||||
err := n.tx.Commit()
|
||||
if err == bolt.ErrTxClosed {
|
||||
return ErrNotInTransaction
|
||||
}
|
||||
|
||||
return err
|
||||
}
|
Reference in New Issue
Block a user