2014-08-03 15:59:56 +02:00
|
|
|
// Copyright 2014 by Sascha L. Teichmann
|
|
|
|
// Use of this source code is governed by the MIT license
|
|
|
|
// that can be found in the LICENSE file.
|
|
|
|
|
2014-08-03 11:25:25 +02:00
|
|
|
package main
|
|
|
|
|
2014-08-19 11:11:41 +02:00
|
|
|
type (
|
2014-09-01 00:19:47 +02:00
|
|
|
Block struct {
|
|
|
|
Key []byte
|
|
|
|
Data []byte
|
|
|
|
}
|
|
|
|
|
2014-08-19 11:11:41 +02:00
|
|
|
Session interface {
|
|
|
|
Fetch(hash, key []byte) ([]byte, error)
|
|
|
|
InTransaction() bool
|
|
|
|
Store(hash, key, value []byte) (bool, error)
|
2014-08-31 19:21:58 +02:00
|
|
|
AllKeys(hash []byte, done chan struct{}) (chan []byte, int, error)
|
2014-09-01 00:19:47 +02:00
|
|
|
SpatialQuery(hash, first, second []byte, done chan struct{}) (chan Block, error)
|
2014-08-19 11:11:41 +02:00
|
|
|
BeginTransaction() error
|
|
|
|
CommitTransaction() error
|
|
|
|
Close() error
|
|
|
|
}
|
2014-08-06 01:11:41 +02:00
|
|
|
|
2014-08-19 11:11:41 +02:00
|
|
|
Backend interface {
|
|
|
|
NewSession() (Session, error)
|
|
|
|
Shutdown() error
|
|
|
|
}
|
|
|
|
)
|