disks

package
v0.0.0-...-e95280a Latest Latest
Warning

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

Go to latest
Published: Jun 19, 2021 License: MIT Imports: 19 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// EventBlockInsert represents an insert block event
	EventBlockInsert = iota

	// EventBlockDelete represents a delete block event
	EventBlockDelete

	// EventBlockMinedInsert represents an insert mined block event
	EventBlockMinedInsert

	// EventBlockMinedDelete represents a delete mined block event
	EventBlockMinedDelete

	// EventLinkInsert represents an insert link event
	EventLinkInsert

	// EventLinkDelete represents a delete link event
	EventLinkDelete

	// EventLinkMinedInsert represents an insert mined link event
	EventLinkMinedInsert

	// EventLinkMinedDelete represents a delete mined link event
	EventLinkMinedDelete

	// EventChainInsert represents an insert chain event
	EventChainInsert

	// EventChainUpdate represents an update chain event
	EventChainUpdate

	// EventChainDelete represents a delete chain event
	EventChainDelete
)

Variables

This section is empty.

Functions

func Init

func Init(
	basePath string,
	fileMode os.FileMode,
	peerSyncInterval time.Duration,
)

Init initializes the package

func NewRepositoryBlock

func NewRepositoryBlock(
	fileRepository files.Repository,
) blocks.Repository

NewRepositoryBlock creates a new disk block repository instance

func NewRepositoryBlockMined

func NewRepositoryBlockMined(
	fileRepository files.Repository,
	pointerFileRepository files.Repository,
) block_mined.Repository

NewRepositoryBlockMined creates a new disk mined block repository

func NewRepositoryChain

func NewRepositoryChain(
	fileRepository files.Repository,
) chains.Repository

NewRepositoryChain creates a new chain repository

func NewRepositoryLink(
	fileRepository files.Repository,
	blockPointerFileRepository files.Repository,
	minedLinkPointerFileRepository files.Repository,
) links.Repository

NewRepositoryLink creates a new disk link repository instance

func NewRepositoryLinkMined

func NewRepositoryLinkMined(
	fileRepository files.Repository,
	linkPointerFileRepository files.Repository,
	headPointerFileRepository files.Repository,
	headFileName string,
) link_mined.Repository

NewRepositoryLinkMined represents a new disk link mined repository instance

func NewServiceBlock

func NewServiceBlock(
	eventManager events.Manager,
	fileService files.Service,
) blocks.Service

NewServiceBlock creates a new disk block service

func NewServiceBlockMined

func NewServiceBlockMined(
	eventManager events.Manager,
	minedBlockRepository block_mined.Repository,
	blockService blocks.Service,
	fileService files.Service,
	pointerFileService files.Service,
) block_mined.Service

NewServiceBlockMined creates a new disk mined block service

func NewServiceLink(
	eventManager events.Manager,
	linkRepository links.Repository,
	blockService blocks.Service,
	fileService files.Service,
	blockPointerFileService files.Service,
	minedLinkPointerFileService files.Service,
) links.Service

NewServiceLink creates a new disk link service instance

func NewServiceLinkMined

func NewServiceLinkMined(
	eventManager events.Manager,
	minedLinkRepository link_mined.Repository,
	linkService links.Service,
	fileService files.Service,
	linkPointerFileService files.Service,
	headPointerFileService files.Service,
	headFileName string,
) link_mined.Service

NewServiceLinkMined creates a new disk link mined service instance

Types

type EntityHydratedBlock

type EntityHydratedBlock struct {
	Tree *hashtree.JSONCompact `json:"tree" hydro:"0"`
}

EntityHydratedBlock represents an entity hydrated block

type EntityHydratedBlockMined

type EntityHydratedBlockMined struct {
	Hash      string `json:"hash"`
	Block     string `json:"block" hydro:"0"`
	Results   string `json:"results" hydro:"1"`
	CreatedOn string `json:"created_on" hydro:"2"`
}

EntityHydratedBlockMined represents an entity hydrated mined block

type EntityHydratedChain

type EntityHydratedChain struct {
	ID        string           `json:"id" hydro:"0"`
	Peers     *HydratedPeers   `json:"peers" hydro:"1"`
	Genesis   *HydratedGenesis `json:"genesis" hydro:"2"`
	Root      string           `json:"root_block_mined_hash" hydro:"3"`
	CreatedOn string           `json:"created_on" hydro:"4"`
	Head      string           `json:"head_mined_link_hash" hydro:"5"`
}

EntityHydratedChain represents an entity hydrated chain

type EntityHydratedLink struct {
	Hash          string `json:"hash"`
	Index         uint   `json:"index" hydro:"0"`
	PrevMinedLink string `json:"prev_mined_link" hydro:"1"`
	NextBlock     string `json:"next_block" hydro:"2"`
}

EntityHydratedLink represents an entity hydrated link

type EntityHydratedLinkMined

type EntityHydratedLinkMined struct {
	Hash      string `json:"hash"`
	Link      string `json:"link" hydro:"0"`
	Results   string `json:"results" hydro:"1"`
	CreatedOn string `json:"created_on" hydro:"2"`
}

EntityHydratedLinkMined represents an entity hydrated mined link

type HydratedGenesis

type HydratedGenesis struct {
	Hash                           string  `json:"hash"`
	MiningValue                    uint8   `json:"mining_value" hydro:"0"`
	BlockBaseDifficulty            uint    `json:"block_base_difficulty" hydro:"1"`
	BlockIncreasePerHashDifficulty float64 `json:"block_increase_per_hash_difficulty" hydro:"2"`
	LinkDifficulty                 uint    `json:"link_difficulty" hydro:"3"`
}

HydratedGenesis represents an hydrated genesis

type HydratedPeer

type HydratedPeer struct {
	Content       string `json:"server" hydro:"0"`
	CreatedOn     string `json:"created_on" hydro:"1"`
	LastUpdatedOn string `json:"last_updated_on,omitempty" hydro:"2"`
}

HydratedPeer represents an hydrated peer

type HydratedPeers

type HydratedPeers struct {
	ID           string          `json:"id" hydro:"0"`
	SyncInterval int64           `json:"sync_interval" hydro:"1"`
	List         []*HydratedPeer `json:"list" hydro:"2"`
	LastSyncTime string          `json:"last_sync_time" hydro:"3"`
}

HydratedPeers represents hydrated peers

Jump to

Keyboard shortcuts

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