fleetdb

package module
v0.0.0-...-2ee7648 Latest Latest
Warning

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

Go to latest
Published: Sep 16, 2019 License: MIT Imports: 28 Imported by: 0

README

FleetDB

FleetDB is a work-in-progress geo-distributed highly consistent key-value prototype. It is buggy. It is in progress. It is my first ever attempt at doing anything in Go, so hopefully it will get better.

This project uses significant portions of code copied from https://github.com/ailidani/paxi

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	//Used for Object Handover decisions
	HandoverN        int
	HandoverInterval int
)

Functions

func NewBenchmarkConfig

func NewBenchmarkConfig() bconfig

Types

type Benchmarker

type Benchmarker struct {
	*History
	// contains filtered or unexported fields
}

func NewBenchmarker

func NewBenchmarker(db DB) *Benchmarker

func (*Benchmarker) Load

func (c *Benchmarker) Load() error

Load reads the benchmark parameters from configuration file

func (*Benchmarker) Run

func (b *Benchmarker) Run()

Run starts the main logic of benchmarking

func (*Benchmarker) Save

func (c *Benchmarker) Save() error

Save saves the benchmark parameters to configuration file

type Client

type Client struct {
	ID ids.ID // client id use the same id as servers in local site
	N  int

	sync.RWMutex
	sync.WaitGroup
	// contains filtered or unexported fields
}

Client main access point of bench lib

func NewClient

func NewClient() *Client

NewClient creates a new Client from config

func (*Client) AddTxDelete

func (c *Client) AddTxDelete(key kv_store.Key, table string)

func (*Client) AddTxGet

func (c *Client) AddTxGet(key kv_store.Key, table string)

Add get for future TX

func (*Client) AddTxPut

func (c *Client) AddTxPut(key kv_store.Key, value kv_store.Value, table string)

Add put for future TX

func (*Client) Delete

func (c *Client) Delete(key kv_store.Key, table string)

Delete post json request

func (*Client) Get

func (c *Client) Get(key kv_store.Key, table string) kv_store.Value

Get post json get request to server url

func (*Client) GetAsync

func (c *Client) GetAsync(key kv_store.Key, table string)

GetAsync do Get request in goroutine

func (*Client) JSONGet

func (c *Client) JSONGet(key kv_store.Key, table string) kv_store.Value

func (*Client) JSONPut

func (c *Client) JSONPut(key kv_store.Key, value kv_store.Value, table string)

func (*Client) JSONTX

func (c *Client) JSONTX(commands []kv_store.Command) bool

func (*Client) PrepTx

func (c *Client) PrepTx()

func (*Client) Put

func (c *Client) Put(key kv_store.Key, value kv_store.Value, table string)

Put post json request

func (*Client) PutAsync

func (c *Client) PutAsync(key kv_store.Key, value kv_store.Value, table string)

PutAsync do Put request in goroutine

func (*Client) PutTx

func (c *Client) PutTx(keys []kv_store.Key, values []kv_store.Value, tables []string) bool

Put post json request

func (*Client) RESTDelete

func (c *Client) RESTDelete(key kv_store.Key, table string) bool

RESTDelete access server's REST API with url = http://ip:port/key

func (*Client) RESTGet

func (c *Client) RESTGet(key kv_store.Key, table string) kv_store.Value

RESTGet access server's REST API with url = http://ip:port/key

func (*Client) RESTPut

func (c *Client) RESTPut(key kv_store.Key, value kv_store.Value, table string)

RESTPut access server's REST API with url = http://ip:port/key and request body of value

func (*Client) RequestDone

func (c *Client) RequestDone() int

RequestDone returns the total number of succeed async reqeusts

func (*Client) SendTX

func (c *Client) SendTX() bool

func (*Client) Start

func (c *Client) Start()

func (*Client) Stop

func (c *Client) Stop()

type DB

type DB interface {
	Init()
	Read(key int) kv_store.Value
	Write(key int, value []byte)
	TxWrite(key []int, value []kv_store.Value) bool
	WriteStr(key int, value string)

	Stop()
}

type History

type History struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

History client operation history mapped by key

func NewHistory

func NewHistory() *History

NewHistory creates a History map

func (*History) Add

func (h *History) Add(key int, input, output interface{}, start, end int64)

Add puts an operation in History

func (*History) Linearizable

func (h *History) Linearizable() bool

Linearizable concurrently checks if each partition of the history is linearizable

func (*History) WriteFile

func (h *History) WriteFile(path string) error

WriteFile writes entire operation history into file

type Node

type Node interface {
	netwrk.Socket
	kv_store.Store
	ID() ids.ID
	Run()
	Retry(r Request)
	Forward(id ids.ID, r Request)
	Register(m interface{}, f interface{})
	GetTX(txid ids.TXID) *Transaction
}

Node is the primary access point for every replica it includes networking, state machine and RESTful API server

func NewNode

func NewNode() Node

NewNode creates a new Node object from configuration

type Read

type Read struct {
	CommandID ids.CommandID
	Key       kv_store.Key
}

Read can be used as a special request that directly read the value of key without go through replication protocol in Replica

func (Read) String

func (r Read) String() string

type ReadReply

type ReadReply struct {
	CommandID ids.CommandID
	Value     kv_store.Value
}

ReadReply cid and value of reading key

func (ReadReply) String

func (r ReadReply) String() string

type Reply

type Reply struct {
	Command   kv_store.Command
	Value     kv_store.Value
	Timestamp int64
	Err       error
}

Reply includes all info that might replies to back the client for the corresponding request

func (Reply) String

func (r Reply) String() string

type Request

type Request struct {
	Command   kv_store.Command
	Timestamp int64

	C chan Reply
}

Request is bench reqeust with http response channel

func (*Request) Reply

func (r *Request) Reply(reply Reply)

Reply replies to the current request

func (Request) String

func (r Request) String() string

type Stat

type Stat struct {
	Data   []float64
	Size   int
	Mean   float64
	Min    float64
	Max    float64
	Median float64
	P95    float64
	P99    float64
	P999   float64
}

func Statistic

func Statistic(latency []time.Duration) Stat

func (Stat) String

func (s Stat) String() string

func (Stat) WriteFile

func (s Stat) WriteFile(path string) error

type Transaction

type Transaction struct {
	TxID      ids.TXID
	CommandID ids.CommandID
	Commands  []kv_store.Command
	CmdMeta   []kv_store.TxCommandMeta

	ClientID ids.ID

	Timestamp int64
	// contains filtered or unexported fields
}

Transaction contains arbitrary number of commands in one request

func NewInProgressTX

func NewInProgressTX(TxID ids.TXID, cmds []kv_store.Command, s []int) *Transaction

func (*Transaction) AreAllCommitted

func (tx *Transaction) AreAllCommitted() bool

func (*Transaction) AreAllWaiting

func (tx *Transaction) AreAllWaiting() bool

func (*Transaction) CanSendP3

func (tx *Transaction) CanSendP3() bool

func (*Transaction) CloseExecChannel

func (r *Transaction) CloseExecChannel()

func (*Transaction) GetExecChannel

func (r *Transaction) GetExecChannel() chan TxExec

func (*Transaction) MakeCommittedWaitingFlags

func (t *Transaction) MakeCommittedWaitingFlags(slots []int)

func (*Transaction) MakeExecChannel

func (r *Transaction) MakeExecChannel(numkeys int)

func (*Transaction) MarkCommitted

func (tx *Transaction) MarkCommitted(key kv_store.Key)

func (*Transaction) MarkWaiting

func (tx *Transaction) MarkWaiting(key kv_store.Key)

func (*Transaction) P3Sent

func (tx *Transaction) P3Sent()

func (*Transaction) ReadyToExec

func (r *Transaction) ReadyToExec(slot int, key kv_store.Key)

Reply replies to the current request

func (*Transaction) Reply

func (r *Transaction) Reply(reply TransactionReply)

Reply replies to the current request

func (Transaction) String

func (t Transaction) String() string

type TransactionReply

type TransactionReply struct {
	OK        bool
	CommandID ids.CommandID
	LeaderID  ids.ID
	ClientID  ids.ID
	Commands  []kv_store.Command
	Timestamp int64
	Err       error
}

TransactionReply is the result of transaction struct

type TxExec

type TxExec struct {
	Slotnum int
	Key     kv_store.Key
}

func (TxExec) String

func (r TxExec) String() string

Directories

Path Synopsis
replication
hlc

Jump to

Keyboard shortcuts

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