tlog

package
v1.1.0-alpha-8 Latest Latest
Warning

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

Go to latest
Published: Sep 28, 2017 License: Apache-2.0 Imports: 4 Imported by: 0

README

GIG TLOG

Transaction Log

TLOG Client

  • TLOG Client library is a client lib that works on zero-os's zerodisk (NBD Server)
  • TLOG Client communicates with TLOG Server via tcp and might be optimized by using dpdk stack.
  • Communication between client and server use binary capnp stream (no RPC).
Data send from the client to server:

Handshake request, send by client upon connection creation

HandshakeRequest
	version  :UInt32;
	vdiskID  :Text;
	firstSequence : UInt64;

Tlog block as tlog entry

Block:
  - sequence : uint64    # block sequence number
  - offset :uint64       # data offset
  - size :uint64         # data size
  - hash :Data           # hash of the data
  - data :Data           # payload data
  - timestamp :uint64    # timestamp of the transaction
  - operation :uint8     # the type of the transaction

See the README there for more details.

TLOG Server

The server code is in the tlogserver directory, see the README there for more details.

Code Generation

Cap'n Proto code (schema/tlog_schema.capnp.go) can be generated using go generate, make sure to have capnp 0.6.0 installed by running ./install_capnp_0.6.0.sh.

Always make sure to keep the generated code up to date with its relevant schema!

More

More verbose documentation can be found in the /docs directory.

Documentation

Index

Constants

View Source
const (
	// LastHashPrefix is the last hash ardb key prefix
	LastHashPrefix = "last_hash_"
)

Variables

View Source
var (
	// FirstAggregateHash is used as the prevHash value
	// for the first aggregation
	FirstAggregateHash = zerodisk.NilHash
)
View Source
var (
	// MinSupportedVersion is the minimum supported version
	// that the tlog client and server of this version supports
	MinSupportedVersion = zerodisk.NewVersion(1, 1, 0, zerodisk.VersionStageAlpha)
)

Functions

func TimeNow

func TimeNow() time.Time

TimeNow returns current UTC time

func TimeNowTimestamp

func TimeNowTimestamp() int64

TimeNowTimestamp returns current timestamp

Types

type BlockStatus

type BlockStatus int8

BlockStatus is returned by the Tlog server when received block

const (
	BlockStatusFlushFailed              BlockStatus = -2
	BlockStatusRecvFailed               BlockStatus = -1
	BlockStatusRecvOK                   BlockStatus = 1
	BlockStatusFlushOK                  BlockStatus = 2
	BlockStatusForceFlushReceived       BlockStatus = 3
	BlockStatusWaitNbdSlaveSyncReceived BlockStatus = 4
)

Tlog Response status values

func (BlockStatus) Error

func (status BlockStatus) Error() error

Error returns this status as an error, returning nil if the status is not an error

func (BlockStatus) Int8

func (status BlockStatus) Int8() int8

Int8 returns the block status as an int8 value

func (BlockStatus) String

func (status BlockStatus) String() string

String returns the name of the block status

type HandshakeStatus

type HandshakeStatus int8

HandshakeStatus is returned by the Tlog server when receiving the initial handshake message from the client

const (
	// returned when something went wrong internally
	// in the tlogserver during the handshake phase
	HandshakeStatusInternalServerError HandshakeStatus = -4
	// returned when the given VdiskID is not legal
	// could be because it's not valid, or because it already
	// exists on the server
	HandshakeStatusInvalidVdiskID HandshakeStatus = -3
	// returned when the given version by the client
	// was not supported by the server
	HandshakeStatusInvalidVersion HandshakeStatus = -2
	// returned when the given request by the client
	// could not be read
	HandshakeStatusInvalidRequest HandshakeStatus = -1
	// returned when all information was accepted
	HandshakeStatusOK HandshakeStatus = 1
)

Handshake status values

func (HandshakeStatus) Error

func (status HandshakeStatus) Error() error

Error returns this status as an error, returning nil if the status is not an error

func (HandshakeStatus) Int8

func (status HandshakeStatus) Int8() int8

Int8 returns the Handshake status as an int8 value

func (HandshakeStatus) String

func (status HandshakeStatus) String() string

String returns the name of the Hanshake status

Jump to

Keyboard shortcuts

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