aboutsummaryrefslogtreecommitdiff
path: root/db.go
blob: a40dbd076ed167281afeb7251f6820bbba06b6f0 (plain)
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
35
36
// Package db implements Berkeley DB 1.85
package db

import "errors"

var (
	ErrFtype = errors.New("file is incorrectly formatted")
	ErrInval = errors.New("parameter is incompatible with the current file specification")
)

type Flag int

// Routine flags
const (
	RCursor      Flag = iota + 1 // del, put, seq
	_                            // unused
	RFirst                       // seq
	RIAfter                      // put (recno)
	RIBefore                     // put (recno)
	RLast                        // seq (btree, recno)
	RNext                        // seq
	RNoOverwrite                 // put
	RPrev                        // seq (btree, recno)
	RSetCursor                   // put (recno)
	RRecnoSync                   // sync (recno)
)

type DB interface {
	Close() (err error)
	Del(key []byte, flag uint) (err error)
	Fd() (fd uintptr)
	Get(key []byte, flag uint) (data []byte, err error)
	Put(key []byte, data []byte, flag uint) (err error)
	Sync(flag uint) (err error)
	Seq(flag uint) (key []byte, data []byte, err error)
}