gofmt
This commit is contained in:
parent
ca7e70bf3a
commit
9f7d3ed340
@ -23,18 +23,18 @@ type Datastore struct {
|
|||||||
|
|
||||||
backupLk sync.RWMutex
|
backupLk sync.RWMutex
|
||||||
|
|
||||||
log chan Entry
|
log chan Entry
|
||||||
closing, closed chan struct{}
|
closing, closed chan struct{}
|
||||||
}
|
}
|
||||||
|
|
||||||
type Entry struct {
|
type Entry struct {
|
||||||
Key, Value []byte
|
Key, Value []byte
|
||||||
Timestamp int64
|
Timestamp int64
|
||||||
}
|
}
|
||||||
|
|
||||||
func Wrap(child datastore.Batching, logdir string) (*Datastore, error) {
|
func Wrap(child datastore.Batching, logdir string) (*Datastore, error) {
|
||||||
ds := &Datastore{
|
ds := &Datastore{
|
||||||
child: child,
|
child: child,
|
||||||
}
|
}
|
||||||
|
|
||||||
if logdir != NoLogdir {
|
if logdir != NoLogdir {
|
||||||
@ -224,7 +224,6 @@ func (b *bbatch) Put(key datastore.Key, value []byte) error {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
return b.b.Put(key, value)
|
return b.b.Put(key, value)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -57,7 +57,6 @@ func (d *Datastore) startLog(logdir string) error {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
go func() {
|
go func() {
|
||||||
defer close(d.closed)
|
defer close(d.closed)
|
||||||
for {
|
for {
|
||||||
@ -91,7 +90,7 @@ func (d *Datastore) createLog(logdir string) (*logfile, error) {
|
|||||||
p := filepath.Join(logdir, strconv.FormatInt(time.Now().Unix(), 10)+".log.cbor")
|
p := filepath.Join(logdir, strconv.FormatInt(time.Now().Unix(), 10)+".log.cbor")
|
||||||
log.Infow("creating log", "file", p)
|
log.Infow("creating log", "file", p)
|
||||||
|
|
||||||
f, err := os.OpenFile(p, os.O_RDWR | os.O_CREATE | os.O_EXCL, 0644)
|
f, err := os.OpenFile(p, os.O_RDWR|os.O_CREATE|os.O_EXCL, 0644)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
@ -127,7 +126,6 @@ func openLog(p string) (*logfile, error) {
|
|||||||
}
|
}
|
||||||
log.Infow("log opened", "file", p)
|
log.Infow("log opened", "file", p)
|
||||||
|
|
||||||
|
|
||||||
// make sure we're at the end of the file
|
// make sure we're at the end of the file
|
||||||
at, err := f.Seek(0, io.SeekCurrent)
|
at, err := f.Seek(0, io.SeekCurrent)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
Loading…
Reference in New Issue
Block a user