File: batch.go

package info (click to toggle)
aptly 1.6.2-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 49,928 kB
  • sloc: python: 10,398; sh: 252; makefile: 184
file content (34 lines) | stat: -rw-r--r-- 529 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
package goleveldb

import (
	"github.com/syndtr/goleveldb/leveldb"
	"github.com/syndtr/goleveldb/leveldb/opt"

	"github.com/aptly-dev/aptly/database"
)

type batch struct {
	db *leveldb.DB
	b  *leveldb.Batch
}

func (b *batch) Put(key, value []byte) error {
	b.b.Put(key, value)

	return nil
}

func (b *batch) Delete(key []byte) error {
	b.b.Delete(key)

	return nil
}

func (b *batch) Write() error {
	return b.db.Write(b.b, &opt.WriteOptions{})
}

// batch should implement database.Batch
var (
	_ database.Batch = &batch{}
)