remote

package module
v0.0.0-...-ad26ee2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 27, 2016 License: MIT Imports: 15 Imported by: 0

README

Remote GoDoc

Remote access to boltdb files via rpc

Mission

Expose the same great api of boltdb over the network.

Use

Just like boltdb... but with a network address.

db, err := remote.Open("tcp://10.0.0.1:9090")

Or open a local database.

db, err := remote.Open("/home/user/local.db")

Progress

Most common opperations are covered. Certain functions that are done through io interfaces have been put off until a better streaming system can be implemented.

DB
  • Batch
  • Begin
  • Close
  • GoString
  • Info (Not applicable)
  • IsReadOnly
  • Path
  • Stats
  • String
  • Sync
  • Update
  • View
Bucket
  • Bucket
  • CreateBucket
  • CreateBucketIfNotExists
  • Cursor
  • Delete
  • DeleteBucket
  • ForEach
  • Get
  • NextSequence
  • Put
  • Root
  • Stats
  • Tx
  • Writeable
Tx
  • Bucket
  • Commit
  • CreateBucket
  • CreateBucketIfNotExists
  • Copy
  • CopyFile
  • Cursor
  • DB
  • DeleteBucket
  • ForEach
  • OnCommit
  • Page (Not applicable)
  • Rollback
  • Size
  • Writeable
  • WriteTo

Plan

Get the api down using the built in go rpc system, then make the move to gRPC to support other language client libraries.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BeginTransactionRequest

type BeginTransactionRequest struct {
	Writable bool
}

BeginTransactionRequest is the response to StartTransaction

func (*BeginTransactionRequest) CodecDecodeSelf

func (x *BeginTransactionRequest) CodecDecodeSelf(d *codec1978.Decoder)

func (*BeginTransactionRequest) CodecEncodeSelf

func (x *BeginTransactionRequest) CodecEncodeSelf(e *codec1978.Encoder)

func (*BeginTransactionRequest) DecodeMsg

func (z *BeginTransactionRequest) DecodeMsg(dc *msgp.Reader) (err error)

DecodeMsg implements msgp.Decodable

func (BeginTransactionRequest) EncodeMsg

func (z BeginTransactionRequest) EncodeMsg(en *msgp.Writer) (err error)

EncodeMsg implements msgp.Encodable

func (BeginTransactionRequest) MarshalMsg

func (z BeginTransactionRequest) MarshalMsg(b []byte) (o []byte, err error)

MarshalMsg implements msgp.Marshaler

func (BeginTransactionRequest) Msgsize

func (z BeginTransactionRequest) Msgsize() (s int)

func (*BeginTransactionRequest) UnmarshalMsg

func (z *BeginTransactionRequest) UnmarshalMsg(bts []byte) (o []byte, err error)

UnmarshalMsg implements msgp.Unmarshaler

type BeginTransactionResponse

type BeginTransactionResponse struct {
	ContextID uint64
}

BeginTransactionResponse is the response to StartTransaction

func (*BeginTransactionResponse) CodecDecodeSelf

func (x *BeginTransactionResponse) CodecDecodeSelf(d *codec1978.Decoder)

func (*BeginTransactionResponse) CodecEncodeSelf

func (x *BeginTransactionResponse) CodecEncodeSelf(e *codec1978.Encoder)

func (*BeginTransactionResponse) DecodeMsg

func (z *BeginTransactionResponse) DecodeMsg(dc *msgp.Reader) (err error)

DecodeMsg implements msgp.Decodable

func (BeginTransactionResponse) EncodeMsg

func (z BeginTransactionResponse) EncodeMsg(en *msgp.Writer) (err error)

EncodeMsg implements msgp.Encodable

func (BeginTransactionResponse) MarshalMsg

func (z BeginTransactionResponse) MarshalMsg(b []byte) (o []byte, err error)

MarshalMsg implements msgp.Marshaler

func (BeginTransactionResponse) Msgsize

func (z BeginTransactionResponse) Msgsize() (s int)

func (*BeginTransactionResponse) UnmarshalMsg

func (z *BeginTransactionResponse) UnmarshalMsg(bts []byte) (o []byte, err error)

UnmarshalMsg implements msgp.Unmarshaler

type Bucket

type Bucket interface {
	Bucket(name []byte) Bucket
	CreateBucket(name []byte) (Bucket, error)
	CreateBucketIfNotExists(name []byte) (Bucket, error)
	DeleteBucket(name []byte) error
	Get(key []byte) []byte
	Put(key, value []byte) error
	ForEach(func(k, v []byte) error) error
	NextSequence() (uint64, error)
	Stats() bolt.BucketStats
	Tx() Tx
	Writeable() bool
}

Bucket is an interface into a bolt bucket.

type BucketForEachRequest

type BucketForEachRequest struct {
	ContextID uint64
	BucketID  uint64
}

BucketForEachRequest gives context for the requst.

type BucketForEachResponse

type BucketForEachResponse struct {
	Key         []byte
	Value       []byte
	Index, Size uint64
}

BucketForEachResponse is a response of every key value pair in a bucket.

type BucketRequest

type BucketRequest struct {
	ContextID uint64
	Key       []byte
}

BucketRequest contains the stats for the transaction that was closed.

func (*BucketRequest) CodecDecodeSelf

func (x *BucketRequest) CodecDecodeSelf(d *codec1978.Decoder)

func (*BucketRequest) CodecEncodeSelf

func (x *BucketRequest) CodecEncodeSelf(e *codec1978.Encoder)

func (*BucketRequest) DecodeMsg

func (z *BucketRequest) DecodeMsg(dc *msgp.Reader) (err error)

DecodeMsg implements msgp.Decodable

func (*BucketRequest) EncodeMsg

func (z *BucketRequest) EncodeMsg(en *msgp.Writer) (err error)

EncodeMsg implements msgp.Encodable

func (*BucketRequest) MarshalMsg

func (z *BucketRequest) MarshalMsg(b []byte) (o []byte, err error)

MarshalMsg implements msgp.Marshaler

func (*BucketRequest) Msgsize

func (z *BucketRequest) Msgsize() (s int)

func (*BucketRequest) UnmarshalMsg

func (z *BucketRequest) UnmarshalMsg(bts []byte) (o []byte, err error)

UnmarshalMsg implements msgp.Unmarshaler

type BucketResponse

type BucketResponse struct {
	BucketID        uint64
	BucketContextID uint64
}

BucketResponse contains the stats for the transaction that was closed.

func (*BucketResponse) CodecDecodeSelf

func (x *BucketResponse) CodecDecodeSelf(d *codec1978.Decoder)

func (*BucketResponse) CodecEncodeSelf

func (x *BucketResponse) CodecEncodeSelf(e *codec1978.Encoder)

func (*BucketResponse) DecodeMsg

func (z *BucketResponse) DecodeMsg(dc *msgp.Reader) (err error)

DecodeMsg implements msgp.Decodable

func (BucketResponse) EncodeMsg

func (z BucketResponse) EncodeMsg(en *msgp.Writer) (err error)

EncodeMsg implements msgp.Encodable

func (BucketResponse) MarshalMsg

func (z BucketResponse) MarshalMsg(b []byte) (o []byte, err error)

MarshalMsg implements msgp.Marshaler

func (BucketResponse) Msgsize

func (z BucketResponse) Msgsize() (s int)

func (*BucketResponse) UnmarshalMsg

func (z *BucketResponse) UnmarshalMsg(bts []byte) (o []byte, err error)

UnmarshalMsg implements msgp.Unmarshaler

type BucketStatsRequest

type BucketStatsRequest struct {
	ContextID uint64
	BucketID  uint64
}

BucketStatsRequest contains stats about a bucket.

func (*BucketStatsRequest) CodecDecodeSelf

func (x *BucketStatsRequest) CodecDecodeSelf(d *codec1978.Decoder)

func (*BucketStatsRequest) CodecEncodeSelf

func (x *BucketStatsRequest) CodecEncodeSelf(e *codec1978.Encoder)

func (*BucketStatsRequest) DecodeMsg

func (z *BucketStatsRequest) DecodeMsg(dc *msgp.Reader) (err error)

DecodeMsg implements msgp.Decodable

func (BucketStatsRequest) EncodeMsg

func (z BucketStatsRequest) EncodeMsg(en *msgp.Writer) (err error)

EncodeMsg implements msgp.Encodable

func (BucketStatsRequest) MarshalMsg

func (z BucketStatsRequest) MarshalMsg(b []byte) (o []byte, err error)

MarshalMsg implements msgp.Marshaler

func (BucketStatsRequest) Msgsize

func (z BucketStatsRequest) Msgsize() (s int)

func (*BucketStatsRequest) UnmarshalMsg

func (z *BucketStatsRequest) UnmarshalMsg(bts []byte) (o []byte, err error)

UnmarshalMsg implements msgp.Unmarshaler

type BucketStatsResponse

type BucketStatsResponse struct {
	bolt.BucketStats
}

BucketStatsResponse contains stats about a bucket.

func (*BucketStatsResponse) CodecDecodeSelf

func (x *BucketStatsResponse) CodecDecodeSelf(d *codec1978.Decoder)

func (*BucketStatsResponse) CodecEncodeSelf

func (x *BucketStatsResponse) CodecEncodeSelf(e *codec1978.Encoder)

type CommitTransactionResponse

type CommitTransactionResponse struct {
}

CommitTransactionResponse contains the stats for the transaction that was closed.

func (*CommitTransactionResponse) CodecDecodeSelf

func (x *CommitTransactionResponse) CodecDecodeSelf(d *codec1978.Decoder)

func (*CommitTransactionResponse) CodecEncodeSelf

func (x *CommitTransactionResponse) CodecEncodeSelf(e *codec1978.Encoder)

type Context

type Context struct {
	sync.RWMutex `msg:"-"`
	// contains filtered or unexported fields
}

A Context holds information about a transaction.

func (*Context) CodecDecodeSelf

func (x *Context) CodecDecodeSelf(d *codec1978.Decoder)

func (*Context) CodecEncodeSelf

func (x *Context) CodecEncodeSelf(e *codec1978.Encoder)

type DB

type DB interface {
	Begin(writeable bool) (Tx, error)
	Close() error
	String() string
	GoString() string
	Path() string
	View(func(tx Tx) error) error
	Update(func(tx Tx) error) error
	Stats() bolt.Stats
}

DB provides an interface to a boltdb

func Open

func Open(path string, options *bolt.Options) (DB, error)

Open returns a new view to a database.

type DBStatsResponse

type DBStatsResponse struct {
	bolt.Stats
}

DBStatsResponse contains boltdb stats.

func (*DBStatsResponse) CodecDecodeSelf

func (x *DBStatsResponse) CodecDecodeSelf(d *codec1978.Decoder)

func (*DBStatsResponse) CodecEncodeSelf

func (x *DBStatsResponse) CodecEncodeSelf(e *codec1978.Encoder)

type Empty

type Empty struct {
}

Empty requests/responses are for functions that do not requre inputs.

func (*Empty) CodecDecodeSelf

func (x *Empty) CodecDecodeSelf(d *codec1978.Decoder)

func (*Empty) CodecEncodeSelf

func (x *Empty) CodecEncodeSelf(e *codec1978.Encoder)

type GetReqeust

type GetReqeust struct {
	BucketID  uint64
	ContextID uint64
	Key       []byte
}

GetReqeust has get request data.

func (*GetReqeust) CodecDecodeSelf

func (x *GetReqeust) CodecDecodeSelf(d *codec1978.Decoder)

func (*GetReqeust) CodecEncodeSelf

func (x *GetReqeust) CodecEncodeSelf(e *codec1978.Encoder)

func (*GetReqeust) DecodeMsg

func (z *GetReqeust) DecodeMsg(dc *msgp.Reader) (err error)

DecodeMsg implements msgp.Decodable

func (*GetReqeust) EncodeMsg

func (z *GetReqeust) EncodeMsg(en *msgp.Writer) (err error)

EncodeMsg implements msgp.Encodable

func (*GetReqeust) MarshalMsg

func (z *GetReqeust) MarshalMsg(b []byte) (o []byte, err error)

MarshalMsg implements msgp.Marshaler

func (*GetReqeust) Msgsize

func (z *GetReqeust) Msgsize() (s int)

func (*GetReqeust) UnmarshalMsg

func (z *GetReqeust) UnmarshalMsg(bts []byte) (o []byte, err error)

UnmarshalMsg implements msgp.Unmarshaler

type GetResponse

type GetResponse struct {
	Val []byte
}

GetResponse has get request data.

func (*GetResponse) CodecDecodeSelf

func (x *GetResponse) CodecDecodeSelf(d *codec1978.Decoder)

func (*GetResponse) CodecEncodeSelf

func (x *GetResponse) CodecEncodeSelf(e *codec1978.Encoder)

func (*GetResponse) DecodeMsg

func (z *GetResponse) DecodeMsg(dc *msgp.Reader) (err error)

DecodeMsg implements msgp.Decodable

func (*GetResponse) EncodeMsg

func (z *GetResponse) EncodeMsg(en *msgp.Writer) (err error)

EncodeMsg implements msgp.Encodable

func (*GetResponse) MarshalMsg

func (z *GetResponse) MarshalMsg(b []byte) (o []byte, err error)

MarshalMsg implements msgp.Marshaler

func (*GetResponse) Msgsize

func (z *GetResponse) Msgsize() (s int)

func (*GetResponse) UnmarshalMsg

func (z *GetResponse) UnmarshalMsg(bts []byte) (o []byte, err error)

UnmarshalMsg implements msgp.Unmarshaler

type LBucket

type LBucket struct {
	// contains filtered or unexported fields
}

LBucket is a local bucket

func (*LBucket) Bucket

func (l *LBucket) Bucket(name []byte) Bucket

Bucket returns the bucket with the given name if it exists.

func (*LBucket) CreateBucket

func (l *LBucket) CreateBucket(name []byte) (Bucket, error)

CreateBucket creats a new bucket with the given name.

func (*LBucket) CreateBucketIfNotExists

func (l *LBucket) CreateBucketIfNotExists(name []byte) (Bucket, error)

CreateBucketIfNotExists creats a new bucket with the given name.

func (*LBucket) DeleteBucket

func (l *LBucket) DeleteBucket(name []byte) error

DeleteBucket creats a new bucket with the given name.

func (*LBucket) ForEach

func (l *LBucket) ForEach(f func(k, v []byte) error) error

ForEach a func on every k,v.

func (*LBucket) Get

func (l *LBucket) Get(key []byte) []byte

Get returns the value stored at the given key.

func (*LBucket) NextSequence

func (l *LBucket) NextSequence() (uint64, error)

NextSequence inserts the given value at the givne key.

func (*LBucket) Put

func (l *LBucket) Put(key, value []byte) error

Put inserts the given value at the givne key.

func (*LBucket) Stats

func (l *LBucket) Stats() bolt.BucketStats

Stats returns the stats about this bucket.

func (*LBucket) Tx

func (l *LBucket) Tx() Tx

Tx returns the parent transaction of the bucket.

func (*LBucket) Writeable

func (l *LBucket) Writeable() bool

Writeable is this a read only bucket?

type LClient

type LClient struct {
	*bolt.DB
}

LClient is a local view to a boltdb.

func (*LClient) Begin

func (l *LClient) Begin(writeable bool) (Tx, error)

Begin a transaction.

func (*LClient) Close

func (l *LClient) Close() error

Close the underlying database.

func (*LClient) Update

func (l *LClient) Update(f func(Tx) error) error

Update opens the database for read/write operations.

func (*LClient) View

func (l *LClient) View(f func(Tx) error) error

View opens the database for read only operation.

type LTx

type LTx struct {
	// contains filtered or unexported fields
}

LTx is a local transaction.

func (*LTx) Bucket

func (l *LTx) Bucket(name []byte) Bucket

Bucket returns the bucket with the given name

func (*LTx) Commit

func (l *LTx) Commit() error

Commit this transaction.

func (*LTx) CreateBucket

func (l *LTx) CreateBucket(name []byte) (Bucket, error)

CreateBucket creates and returns a new bucket.

func (*LTx) CreateBucketIfNotExists

func (l *LTx) CreateBucketIfNotExists(name []byte) (Bucket, error)

CreateBucketIfNotExists creates and returns a new bucket.

func (*LTx) DB

func (l *LTx) DB() DB

DB returns the database that this transaction is from.

func (*LTx) DeleteBucket

func (l *LTx) DeleteBucket(name []byte) error

DeleteBucket creates and returns a new bucket.

func (*LTx) OnCommit

func (l *LTx) OnCommit(h func())

OnCommit adds a handelr to be called after commit is called.

func (*LTx) Rollback

func (l *LTx) Rollback() error

Rollback this transaction.

func (*LTx) Size

func (l *LTx) Size() int64

Size returs the size of the database.

type NextSequenceRequest

type NextSequenceRequest struct {
	ContextID uint64
	BucketID  uint64
}

NextSequenceRequest gives context for the next sequence call.

type PingRequest

type PingRequest struct {
	T time.Time
}

PingRequest is a test ping request

func (*PingRequest) CodecDecodeSelf

func (x *PingRequest) CodecDecodeSelf(d *codec1978.Decoder)

func (*PingRequest) CodecEncodeSelf

func (x *PingRequest) CodecEncodeSelf(e *codec1978.Encoder)

type PingResponse

type PingResponse struct {
	To   time.Duration
	From time.Time
}

PingResponse is a test ping result

func (*PingResponse) CodecDecodeSelf

func (x *PingResponse) CodecDecodeSelf(d *codec1978.Decoder)

func (*PingResponse) CodecEncodeSelf

func (x *PingResponse) CodecEncodeSelf(e *codec1978.Encoder)

func (*PingResponse) RoundTrip

func (p *PingResponse) RoundTrip() time.Duration

RoundTrip gives the time the request took round trip

type PutReqeust

type PutReqeust struct {
	BucketID  uint64
	ContextID uint64
	Key       []byte
	Val       []byte
}

PutReqeust has get request data.

func (*PutReqeust) CodecDecodeSelf

func (x *PutReqeust) CodecDecodeSelf(d *codec1978.Decoder)

func (*PutReqeust) CodecEncodeSelf

func (x *PutReqeust) CodecEncodeSelf(e *codec1978.Encoder)

func (*PutReqeust) DecodeMsg

func (z *PutReqeust) DecodeMsg(dc *msgp.Reader) (err error)

DecodeMsg implements msgp.Decodable

func (*PutReqeust) EncodeMsg

func (z *PutReqeust) EncodeMsg(en *msgp.Writer) (err error)

EncodeMsg implements msgp.Encodable

func (*PutReqeust) MarshalMsg

func (z *PutReqeust) MarshalMsg(b []byte) (o []byte, err error)

MarshalMsg implements msgp.Marshaler

func (*PutReqeust) Msgsize

func (z *PutReqeust) Msgsize() (s int)

func (*PutReqeust) UnmarshalMsg

func (z *PutReqeust) UnmarshalMsg(bts []byte) (o []byte, err error)

UnmarshalMsg implements msgp.Unmarshaler

type PutResponse

type PutResponse struct {
}

PutResponse has get request data.

func (*PutResponse) CodecDecodeSelf

func (x *PutResponse) CodecDecodeSelf(d *codec1978.Decoder)

func (*PutResponse) CodecEncodeSelf

func (x *PutResponse) CodecEncodeSelf(e *codec1978.Encoder)

type RBucket

type RBucket struct {
	// contains filtered or unexported fields
}

RBucket is a remote bucket.

func (*RBucket) Bucket

func (r *RBucket) Bucket(name []byte) Bucket

Bucket returns the bucket with the given name

func (*RBucket) CreateBucket

func (r *RBucket) CreateBucket(name []byte) (Bucket, error)

CreateBucket creates and returns a new bucket.

func (*RBucket) CreateBucketIfNotExists

func (r *RBucket) CreateBucketIfNotExists(name []byte) (Bucket, error)

CreateBucketIfNotExists creates and returns a new bucket.

func (*RBucket) DeleteBucket

func (r *RBucket) DeleteBucket(name []byte) error

DeleteBucket creates and returns a new bucket.

func (*RBucket) ForEach

func (r *RBucket) ForEach(f func(k, v []byte) error) error

ForEach k,v pair TODO this needs pagination.

func (*RBucket) Get

func (r *RBucket) Get(key []byte) []byte

Get returns the value of the given key.

func (*RBucket) NextSequence

func (r *RBucket) NextSequence() (uint64, error)

NextSequence returns the next unique id for this bucket.

func (*RBucket) Put

func (r *RBucket) Put(key, value []byte) error

Put inserts the given value at the given key.

func (*RBucket) Stats

func (r *RBucket) Stats() bolt.BucketStats

Stats returns the stats of a bucket.

func (*RBucket) Tx

func (r *RBucket) Tx() Tx

Tx returns the transaction this bucket is a part of.

func (*RBucket) Writeable

func (r *RBucket) Writeable() bool

Writeable will always be true.

type RClient

type RClient struct {
	// contains filtered or unexported fields
}

RClient is a remote view to the remote server.

func (*RClient) Begin

func (r *RClient) Begin(writeable bool) (Tx, error)

Begin a transaction.

func (*RClient) Close

func (r *RClient) Close() error

Close the connection to the database.

func (*RClient) GoString

func (r *RClient) GoString() string

GoString returns the go string representation of the client.

func (*RClient) IsReadOnly

func (r *RClient) IsReadOnly() bool

IsReadOnly or not?

func (*RClient) Path

func (r *RClient) Path() string

Path returns the host of the remote client

func (*RClient) Stats

func (r *RClient) Stats() bolt.Stats

Stats returns stats about this database.

func (*RClient) String

func (r *RClient) String() string

String returns the string representation of the client.

func (*RClient) Update

func (r *RClient) Update(f func(tx Tx) error) error

Update opens a read/write transaction to the database.

func (*RClient) View

func (r *RClient) View(f func(tx Tx) error) error

View opens a read only transaction to the database.

type RTx

type RTx struct {
	// contains filtered or unexported fields
}

RTx is a local transaction.

func (*RTx) Bucket

func (r *RTx) Bucket(name []byte) Bucket

Bucket returns the bucket with the given name.

func (*RTx) Commit

func (r *RTx) Commit() error

Commit this transaction.

func (*RTx) CreateBucket

func (r *RTx) CreateBucket(name []byte) (Bucket, error)

CreateBucket creates and returns a new bucket.

func (*RTx) CreateBucketIfNotExists

func (r *RTx) CreateBucketIfNotExists(name []byte) (Bucket, error)

CreateBucketIfNotExists creates and returns a new bucket.

func (*RTx) DB

func (r *RTx) DB() DB

DB returns the database that this transaction is from.

func (*RTx) DeleteBucket

func (r *RTx) DeleteBucket(name []byte) error

DeleteBucket creates and returns a new bucket.

func (*RTx) OnCommit

func (r *RTx) OnCommit(h func())

OnCommit adds a handler to be called when a transaction is commited.

func (*RTx) Rollback

func (r *RTx) Rollback() error

Rollback this transaction.

func (*RTx) Size

func (r *RTx) Size() int64

Size returns the size of the database from the view of this transaction.

type RollbackTransactionResponse

type RollbackTransactionResponse struct {
}

RollbackTransactionResponse contains the stats for the transaction that was closed.

func (*RollbackTransactionResponse) CodecDecodeSelf

func (x *RollbackTransactionResponse) CodecDecodeSelf(d *codec1978.Decoder)

func (*RollbackTransactionResponse) CodecEncodeSelf

func (x *RollbackTransactionResponse) CodecEncodeSelf(e *codec1978.Encoder)

type Server

type Server struct {
	sync.RWMutex `msg:"-"`
	// contains filtered or unexported fields
}

A Server runs a remote view to a boltdb.

func OpenServer

func OpenServer(path string) (*Server, error)

OpenServer opens a bolt db and and wraps it in a server.

func (*Server) BeginTransaction

func (s *Server) BeginTransaction(req *BeginTransactionRequest, resp *BeginTransactionResponse) error

BeginTransaction creates a new transaction with the given mode.

func (*Server) Bucket

func (s *Server) Bucket(req BucketRequest, resp *BucketResponse) error

Bucket creates a new transaction with the given mode.

func (*Server) BucketForEachNext

func (s *Server) BucketForEachNext(req *BucketForEachRequest, resp *BucketForEachResponse) error

BucketForEachNext returns the next key value pair in the iteration.

func (*Server) BucketForEachStart

func (s *Server) BucketForEachStart(req *BucketForEachRequest, resp *BucketForEachResponse) error

BucketForEachStart runs back all k,v pairs so that a function can be run over them.

func (*Server) BucketForEachStop

func (s *Server) BucketForEachStop(req *BucketForEachRequest, resp *Empty) error

BucketForEachStop will stop the for-each loop.

func (*Server) BucketStats

func (s *Server) BucketStats(req *BucketStatsRequest, resp *BucketStatsResponse) error

BucketStats returns the stats about a bucket.

func (*Server) CodecDecodeSelf

func (x *Server) CodecDecodeSelf(d *codec1978.Decoder)

func (*Server) CodecEncodeSelf

func (x *Server) CodecEncodeSelf(e *codec1978.Encoder)

func (*Server) CommitTransaction

func (s *Server) CommitTransaction(contextID uint64, c *CommitTransactionResponse) error

CommitTransaction creates a new transaction with the given mode.

func (*Server) CreateBucket

func (s *Server) CreateBucket(req BucketRequest, resp *BucketResponse) error

CreateBucket creates a new bucket with the given name.

func (*Server) CreateBucketIfNotExists

func (s *Server) CreateBucketIfNotExists(req BucketRequest, resp *BucketResponse) error

CreateBucketIfNotExists creates a new bucket if it doesn't already exist. Returns the bucket regardless.

func (*Server) DBStats

func (s *Server) DBStats(Empty, resp *DBStatsResponse) error

DBStats returns database level stats

func (*Server) DeleteBucket

func (s *Server) DeleteBucket(req BucketRequest, resp *BucketResponse) error

DeleteBucket removes the bucket with the given key.

func (*Server) Get

func (s *Server) Get(req *GetReqeust, resp *GetResponse) error

Get returns the value stored at the given key.

func (*Server) NextSequence

func (s *Server) NextSequence(req *NextSequenceRequest, resp *uint64) error

NextSequence will return the next unique ID for this bucket.

func (*Server) Ping

func (s *Server) Ping(req PingRequest, resp *PingResponse) error

Ping the remote server.

func (*Server) Put

func (s *Server) Put(req *PutReqeust, resp *PutResponse) error

Put inserts the given value at the given key.

func (*Server) RollbackTransaction

func (s *Server) RollbackTransaction(contextID uint64, r *RollbackTransactionResponse) error

RollbackTransaction creates a new transaction with the given mode.

func (*Server) ServeConn

func (s *Server) ServeConn(conn io.ReadWriteCloser) error

ServeConn will serve the rpc via a io.ReadWriteCloser

func (*Server) ServeTCP

func (s *Server) ServeTCP(addr string) error

ServeTCP will serve the rpc via a tcp socket

func (*Server) TransactionSize

func (s *Server) TransactionSize(contextID uint64, size *uint64) error

TransactionSize returns the size of the database from the view of the current transaction.

type Tx

type Tx interface {
	Bucket(name []byte) Bucket
	Commit() error
	CreateBucket(name []byte) (Bucket, error)
	CreateBucketIfNotExists(name []byte) (Bucket, error)
	DB() DB
	DeleteBucket(name []byte) error
	OnCommit(h func())
	Rollback() error
	Size() int64
}

Tx is a transaction

Directories

Path Synopsis
cmd

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL