gostore

package module
v0.0.0-...-71c1a82 Latest Latest
Warning

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

Go to latest
Published: Apr 12, 2019 License: MIT Imports: 17 Imported by: 0

README

Gostore CircleCI Coverage Status golangci

Gostore is a distributed hash table implementation based on the SWIM protocol and rendezvous hashing to distribute data among nodes.

Disclaimer: this is a pet project, built to explore the world of DHTs and distributed systems. Do not use it in production.

Features

  • In-memory, with optional disk persistence using BadgerDB
  • Simple query/response protocol
  • Time-To-Live (TTL) eviction policy
  • Highly available
  • Horizontally scalable

Usage

TODO

Running the tests
make tests

Architecture

TODO

License

This library is under the MIT license.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Cluster

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

func NewCluster

func NewCluster(logger *logrus.Logger, port int) *Cluster

func (*Cluster) Join

func (cluster *Cluster) Join(member string) error

func (Cluster) LocalNode

func (cluster Cluster) LocalNode() Node

func (Cluster) Members

func (cluster Cluster) Members() []Node

func (Cluster) ResponsibleNode

func (cluster Cluster) ResponsibleNode(key string) Node

func (*Cluster) Shutdown

func (cluster *Cluster) Shutdown() error

type ClusterJoinCmd

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

func NewClusterJoinCmd

func NewClusterJoinCmd(arguments string) (*ClusterJoinCmd, error)

func (ClusterJoinCmd) String

func (cmd ClusterJoinCmd) String() string

type ClusterListNodesCmd

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

func NewClusterListNodesCmd

func NewClusterListNodesCmd() (*ClusterListNodesCmd, error)

func (ClusterListNodesCmd) String

func (cmd ClusterListNodesCmd) String() string

type ClusterStatsCmd

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

func NewClusterStatsCmd

func NewClusterStatsCmd() (*ClusterStatsCmd, error)

func (ClusterStatsCmd) String

func (cmd ClusterStatsCmd) String() string

type Command

type Command interface {
	fmt.Stringer
	// contains filtered or unexported methods
}

type Config

type Config struct {
	Host string
	Port int

	StoragePath string

	ReadTimeout  time.Duration
	WriteTimeout time.Duration

	StabilizeInterval time.Duration
	// percentage of keys in the store to stabilize per batch
	StabilizeBatchSize int

	EvictionInterval time.Duration
	// percentage of keys in the store to evict per batch
	EvictionBatchSize int
}

func DefaultConfig

func DefaultConfig() Config

type DelCmd

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

func NewDelCmd

func NewDelCmd(arguments string) (*DelCmd, error)

func (DelCmd) String

func (cmd DelCmd) String() string

type FetchCmd

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

func NewFetchCmd

func NewFetchCmd(arguments string) (*FetchCmd, error)

func (FetchCmd) String

func (cmd FetchCmd) String() string

type Node

type Node interface {
	Address() string
	SameAs(other Node) bool
}

type NodeRef

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

func (NodeRef) Address

func (node NodeRef) Address() string

func (NodeRef) SameAs

func (node NodeRef) SameAs(other Node) bool

func (NodeRef) String

func (node NodeRef) String() string

type NodeStatsCmd

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

func NewNodeStatsCmd

func NewNodeStatsCmd() (*NodeStatsCmd, error)

func (NodeStatsCmd) String

func (cmd NodeStatsCmd) String() string

type PayloadResult

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

func (PayloadResult) String

func (r PayloadResult) String() string

type Result

type Result interface {
	fmt.Stringer
}

type Router

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

func NewRouter

func NewRouter() Router

func (*Router) AddNode

func (router *Router) AddNode(node Node)

func (*Router) RemoveNode

func (router *Router) RemoveNode(node Node)

func (*Router) ResponsibleNode

func (router *Router) ResponsibleNode(key string) Node

type Server

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

func NewServer

func NewServer(logger *log.Logger, config Config) Server

func (Server) JoinCluster

func (server Server) JoinCluster(member string)

func (*Server) Start

func (server *Server) Start()

func (*Server) Stop

func (server *Server) Stop()

type StoreCmd

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

func NewStoreCmd

func NewStoreCmd(arguments string) (*StoreCmd, error)

func (StoreCmd) String

func (cmd StoreCmd) String() string

type StoreExpiringCmd

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

func NewStoreExpiringCmd

func NewStoreExpiringCmd(arguments string) (*StoreExpiringCmd, error)

func (StoreExpiringCmd) String

func (cmd StoreExpiringCmd) String() string

type VoidResult

type VoidResult struct{}

func (VoidResult) String

func (r VoidResult) String() string

Directories

Path Synopsis
cmd
internal

Jump to

Keyboard shortcuts

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