log

package
v0.0.0-...-f74767b Latest Latest
Warning

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

Go to latest
Published: Jun 23, 2022 License: Apache-2.0 Imports: 19 Imported by: 0

README

  • Add badger

Documentation

Index

Constants

View Source
const RaftRPC = 1

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	Raft struct {
		raft.Config
		StreamLayer *StreamLayer
		BindAddr    string
		Bootstrap   bool
		Voter       bool
	}
}

type CoreDB

type CoreDB interface {
	Insert(item badger.Item) error
	FindBy(field, expression string) ([]badger.Item, error)
}

This interface hold the functions that help to manage the cluster database

type DistributedLog

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

func NewDistributedLog

func NewDistributedLog(dataDir string, config Config) (
	*DistributedLog,
	error,
)

func (*DistributedLog) Close

func (l *DistributedLog) Close() error

func (*DistributedLog) Get

func (l *DistributedLog) Get(key string) (*api.Record, error)

Commitlog implementation

func (*DistributedLog) GetServers

func (l *DistributedLog) GetServers(ctx context.Context) ([]*api.Server, error)

IMplement here the object

func (*DistributedLog) Join

func (l *DistributedLog) Join(id, addr string, voter bool) error

func (*DistributedLog) Leave

func (l *DistributedLog) Leave(id string) error

Membership handler implemetation

func (*DistributedLog) Set

func (l *DistributedLog) Set(record *api.Record) (string, error)

Commitlog implementation

func (*DistributedLog) WaitForLeader

func (l *DistributedLog) WaitForLeader(timeout time.Duration) error

type Entry

type Entry struct {
	Key      []byte
	Metadata FMetadata //Meta for entry. This meta should be difined in a code table. Now Just a String
	Value    []byte
}

type FMetadata

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

type Log

type Log struct {
	Dir    string
	Config Config
	// contains filtered or unexported fields
}

func NewLog

func NewLog(dir string, c Config) (*Log, error)

func (*Log) Close

func (l *Log) Close() error

func (*Log) Delete

func (l *Log) Delete(key string) error

func (*Log) ExistKeyWith

func (l *Log) ExistKeyWith(prefix []byte, neq []byte) (bool, error)

func (*Log) FindBy

func (l *Log) FindBy(field, expression string) ([]badger.Item, error)

func (*Log) Get

func (l *Log) Get(key string) (*api.Record, error)

func (*Log) Insert

func (l *Log) Insert(item badger.Item) error

func (*Log) Set

func (l *Log) Set(record *api.Record) (string, error)

type OTx

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

type RequestType

type RequestType uint8
const (
	AppendRequestType RequestType = 0
)

type StoreDB

type StoreDB interface {
	// Set key and value
	Set(key string, value string) error
	// Get value by key
	Get(key string) interface{}
	// Delete removes a session key value based on its key.
	Delete(key string) (deleted bool)
	// Close connection to store
	Close() error
}

type StreamLayer

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

func NewStreamLayer

func NewStreamLayer(
	ln net.Listener,
) *StreamLayer

func (*StreamLayer) Accept

func (s *StreamLayer) Accept() (net.Conn, error)

func (*StreamLayer) Addr

func (s *StreamLayer) Addr() net.Addr

func (*StreamLayer) Close

func (s *StreamLayer) Close() error

func (*StreamLayer) Dial

func (s *StreamLayer) Dial(
	addr raft.ServerAddress,
	timeout time.Duration,
) (net.Conn, error)

type TxMetadata

type TxMetadata struct {
}

Jump to

Keyboard shortcuts

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