boltcluster

package module
v0.0.0-...-7fb2343 Latest Latest
Warning

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

Go to latest
Published: Feb 11, 2018 License: MIT Imports: 9 Imported by: 0

Documentation

Overview

boltcluster is a distribution handling wrapper around boltdb for vertical scaling. The package made for one purpose, to achive higher io and smaller db sizes, on a single computer.

It can be configured with the following Environment variables:

  • TRANSACTION_LIMIT_SIZE This will allow you to configure updates transaction limit size, in other words, when multiple update received to be executed, the the cluster try to optimize the execution into a single transaction, so it can be achived faster with less io

Index

Constants

This section is empty.

Variables

View Source
var ErrDatabaseAlreadyOpen = errors.New("Database Already open!")

ErrDatabaseAlreadyOpen is an error that returnted when Open method already initialized db connection

Functions

This section is empty.

Types

type BoltDBTxFunction

type BoltDBTxFunction func(*bolt.Tx) error

BoltDBTxFunction bolt db transaction function

type Cluster

type Cluster struct {
	Logger *Logger
	// contains filtered or unexported fields
}

Cluster object that handles storing new uniq values

func New

func New(options ...Options) *Cluster

New method Return a new Cluster struct

func (*Cluster) Batch

func (c *Cluster) Batch(distributionKey int, fn BoltDBTxFunction) error

Batch is the main interface to interact with the database with batch transaction

func (*Cluster) Close

func (c *Cluster) Close() error

Close The database connections

func (*Cluster) Open

func (c *Cluster) Open() error

Open connect the cluster to the distributed databases

func (*Cluster) ParallelBatch

func (c *Cluster) ParallelBatch(fn BoltDBTxFunction) []error

ParallelBatch execute batch transaction function on each database

func (*Cluster) ParallelUpdate

func (c *Cluster) ParallelUpdate(fn BoltDBTxFunction) []error

ParallelUpdate execute update transaction function on each database

func (*Cluster) ParallelView

func (c *Cluster) ParallelView(fn BoltDBTxFunction) []error

ParallelView execute view transaction function on each database

func (*Cluster) RedistributeTo

func (c *Cluster) RedistributeTo(newSize int, moveFn BoltDBTxFunction) error

RedistributeTo help you to change the db distribution size on the disc

func (*Cluster) Update

func (c *Cluster) Update(distributionKey int, fn BoltDBTxFunction) error

Update is the main interface to interact with the database

func (*Cluster) View

func (c *Cluster) View(distributionKey int, fn BoltDBTxFunction) error

View execute a single view transaction function based on a distributionKey Not async

type Logger

type Logger struct {
	Verbosity bool
	// contains filtered or unexported fields
}

Logger makes able to set Verbosity using the standard logger

func (*Logger) Fatal

func (l *Logger) Fatal(v ...interface{})

Fatal is equivalent to l.Print() followed by a call to os.Exit(1).

func (*Logger) Fatalf

func (l *Logger) Fatalf(format string, v ...interface{})

Fatalf is equivalent to l.Printf() followed by a call to os.Exit(1).

func (*Logger) Fatalln

func (l *Logger) Fatalln(v ...interface{})

Fatalln is equivalent to l.Println() followed by a call to os.Exit(1).

func (*Logger) Print

func (l *Logger) Print(v ...interface{})

Print calls l.Output to print to the logger. Arguments are handled in the manner of fmt.Print.

func (*Logger) Printf

func (l *Logger) Printf(format string, v ...interface{})

Printf calls l.Output to print to the logger. Arguments are handled in the manner of fmt.Printf.

func (*Logger) Println

func (l *Logger) Println(v ...interface{})

Println calls l.Output to print to the logger. Arguments are handled in the manner of fmt.Println.

type Options

type Options interface {
	Configure(config *config)
}

Options allow to configure the cluster options

func SetDirectoryPathTo

func SetDirectoryPathTo(newDirectoryPath string) Options

SetDirectoryPathTo allow you can Configure where to set the path for the db cluster

Jump to

Keyboard shortcuts

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