local

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Mar 22, 2018 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Overview

Package local implements DB Transactions for the local "in memory" transport. This implementation uses a collection of transaction items that are propagated to registered GO channels.

Index

Constants

This section is empty.

Variables

View Source
var DefaultTransport = syncbase.NewRegistry()

DefaultTransport is a default registry.

Functions

func Get

func Get() *syncbase.Registry

Get returns the global singleton instance.

Types

type BytesTxn

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

BytesTxn is just a concurrent map of Bytes messages. The intent is to collect the user data and propagate them when commit happens.

func NewBytesTxn

func NewBytesTxn(commit func(map[string]datasync.ChangeValue) error) *BytesTxn

NewBytesTxn is a constructor.

func (*BytesTxn) Commit

func (txn *BytesTxn) Commit() error

Commit executes the transaction.

func (*BytesTxn) Delete

func (txn *BytesTxn) Delete(key string) keyval.BytesTxn

Delete add delete operation into transaction.

func (*BytesTxn) Put

func (txn *BytesTxn) Put(key string, data []byte) keyval.BytesTxn

Put adds store operation into transaction.

type BytesTxnItem

type BytesTxnItem struct {
	Data   []byte
	Delete bool
}

BytesTxnItem is used in BytesTxn.

type ProtoTxn

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

ProtoTxn is a concurrent map of proto messages. The intent is to collect the user data and propagate them when commit happens.

func NewProtoTxn

func NewProtoTxn(commit func(map[string]datasync.ChangeValue) error) *ProtoTxn

NewProtoTxn is a constructor.

func (*ProtoTxn) Commit

func (txn *ProtoTxn) Commit() error

Commit executes the transaction.

func (*ProtoTxn) Delete

func (txn *ProtoTxn) Delete(key string) keyval.ProtoTxn

Delete adds delete operation into transaction.

func (*ProtoTxn) Put

func (txn *ProtoTxn) Put(key string, data proto.Message) keyval.ProtoTxn

Put adds store operation into transaction.

type ProtoTxnItem

type ProtoTxnItem struct {
	Data   proto.Message
	Delete bool
}

ProtoTxnItem is used in ProtoTxn.

func (*ProtoTxnItem) GetValue

func (lazy *ProtoTxnItem) GetValue(out proto.Message) error

GetValue returns the value of the pair.

Jump to

Keyboard shortcuts

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