db

package
v0.0.0-...-55c0a6c Latest Latest
Warning

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

Go to latest
Published: Nov 27, 2021 License: GPL-3.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	BUFF_SIZE                        = 64
	COMMAND_TYPES                    = 3
	RESPONSE_TYPES                   = 5
	MIN_BUCKETNAME_SIZE              = 3
	QUERY_TYPES         QueryType    = 7
	CLOSE_COMMAND                    = iota * COMMAND_TYPES
	ERROR               ResponseType = iota * RESPONSE_TYPES
	UPDATE
	CREATE
	NOTFOUND
	READ QueryType = iota * QUERY_TYPES
	WRITE
	DELETE
	CLOSE
)
View Source
const (
	RPC_CONTROL_NAME = "DbControl"
	RPC_TCP_PORT     = ":5514"
)
View Source
const RELATIONS = "rxds"

Variables

This section is empty.

Functions

func ConnectToStorage

func ConnectToStorage(ch chan *Query) <-chan *Response

Connect a Client to this Storage

func NewDb

func NewDb()

Types

type Client

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

func NewClient

func NewClient() (*Client, error)

func (*Client) Add

func (c *Client) Add(typeName string, d interface{}) (*ManagedDocument, error)

func (*Client) Close

func (c *Client) Close()

func (*Client) Query

func (c *Client) Query(q *Query) *Future

func (*Client) Update

func (c *Client) Update(d *Document) (*ManagedDocument, error)

type Command

type Command struct {
}

type DbConfiguration

type DbConfiguration struct {
	Path string
	Mode os.FileMode
	Opt  *bolt.Options
}

type DbRunner

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

func (*DbRunner) Start

func (t *DbRunner) Start()

type Document

type Document struct {
	TypeName string
	Value    interface{}
	Id       []byte
}

type Future

type Future struct {
	C *Client
}

func (*Future) Then

func (f *Future) Then(fn func(Document) error) error

[]byte -> DataSet ID Document -> DataSet Value

type ManagedDocument

type ManagedDocument struct {
	Id   []byte
	Type string
	// contains filtered or unexported fields
}
func (m *ManagedDocument) Link(typeName string, d interface{}) (*ManagedDocument, error)

type Query

type Query struct {
	DataType string
	ID       []byte
	Type     QueryType
	Payload  *Document
}

type QueryType

type QueryType int

type Response

type Response struct {
	Status ResponseType
	Error  error
	Value  Document
	Key    []byte
}

type ResponseType

type ResponseType int

type Storage

type Storage struct {
	Reader  chan *Query
	Result  chan *Response
	Writer  chan *Document
	Control chan *Command
	// Cursor chan chan *Document
	Clients sync.WaitGroup
	Lock    sync.Mutex
	// contains filtered or unexported fields
}

func NewStorage

func NewStorage(cfg *DbConfiguration) (s *Storage, err error)

Creates new BoltDB Backend Type with initialized Channels

func (*Storage) Close

func (s *Storage) Close()

Closes Current BoltDB

func (*Storage) Serve

func (s *Storage) Serve() error

Jump to

Keyboard shortcuts

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