shard

package
v0.0.0-...-4273fad Latest Latest
Warning

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

Go to latest
Published: Mar 21, 2019 License: MIT Imports: 6 Imported by: 0

Documentation

Overview

Copyright 2018-2019 The trust-net Authors Sharding Layer interface and implementation for DLT Statck

Copyright 2018-2019 The trust-net Authors

Index

Constants

This section is empty.

Variables

View Source
var ShardSeqOne = uint64(0x01)

Functions

func GenesisShardTx

func GenesisShardTx(shardId []byte) dto.Transaction

func NewSharder

func NewSharder(db repo.DltDb, dbp db.DbProvider) (*sharder, error)

func Numeric

func Numeric(id []byte) uint64

func SignedShardTransaction

func SignedShardTransaction(payload string) (dto.Transaction, dto.Transaction)

Types

type Sharder

type Sharder interface {
	// get a lock on world state at the beginning of transaction processing
	LockState() error
	// unlock the world state at the end of transaction processing
	UnlockState()
	// commit world state once transaction has been successfully processed
	CommitState(tx dto.Transaction) error
	// register application shard with the DLT stack
	Register(shardId []byte, txHandler func(tx dto.Transaction, state state.State) error) error
	// unregister application shard from DLT stack
	Unregister() error
	// populate a transaction Anchor
	Anchor(a *dto.Anchor) error
	// provide anchor for syncing with specified shard
	SyncAnchor(shardId []byte) *dto.Anchor
	// provide max ancestors from specified start hash
	Ancestors(startHash [64]byte, max uint64) [][64]byte
	// provide children of specified hash
	Children(parent [64]byte) [][64]byte
	// Approve submitted transaction
	Approve(tx dto.Transaction) error
	// Handle Transaction
	Handle(tx dto.Transaction) error
	// get value for a resource from current world state for the registered shard
	GetState(key []byte) (*state.Resource, error)
	// flush a shard
	Flush(shardId []byte) error
}

Jump to

Keyboard shortcuts

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