message

package
v0.0.0-...-2e52d37 Latest Latest
Warning

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

Go to latest
Published: Jan 18, 2022 License: MIT Imports: 6 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Query

type Query struct {
	C chan QueryReply
}

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

func (*Query) Reply

func (r *Query) Reply(reply QueryReply)

type QueryReply

type QueryReply struct {
	Info string
}

QueryReply cid and value of reading key

type Read

type Read struct {
	CommandID int
	Key       db.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 int
	Value     db.Value
}

ReadReply cid and value of reading key

type Register

type Register struct {
	Client bool
	ID     identity.NodeID
	Addr   string
}

Register message type is used to register self (node or client) with master node

type Transaction

type Transaction struct {
	Command    db.Command
	Properties map[string]string
	Timestamp  time.Time
	NodeID     identity.NodeID // forward by node
	ID         string
	C          chan TransactionReply // reply channel created by request receiver
}

Transaction is client reqeust with http response channel

func (*Transaction) Reply

func (r *Transaction) Reply(reply TransactionReply)

TransactionReply replies to current client session

func (Transaction) String

func (r Transaction) String() string

type TransactionReply

type TransactionReply struct {
	Command    db.Command
	Value      db.Value
	Properties map[string]string
	Delay      time.Duration
	Err        error
}

TransactionReply includes all info that might replies to back the client for the coresponding reqeust

func NewReply

func NewReply(delay time.Duration) TransactionReply

func (TransactionReply) String

func (r TransactionReply) String() string

Jump to

Keyboard shortcuts

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