shared

package
v0.0.0-...-dde17ac Latest Latest
Warning

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

Go to latest
Published: Dec 24, 2018 License: GPL-3.0 Imports: 5 Imported by: 0

Documentation

Overview

Package shared defines independent utilities helpful for a sharding-enabled, Ethereum blockchain such as blob serialization as more.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ConvertFromRawBlob

func ConvertFromRawBlob(blob *RawBlob, i interface{}) error

ConvertFromRawBlob converts raw blob back from a byte array to its interface.

func Serialize

func Serialize(rawBlobs []*RawBlob) ([]byte, error)

Serialize takes a set of blobs and converts them to a single byte array.

Types

type Flags

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

Flags to add to chunk delimiter.

type RawBlob

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

RawBlob type which will contain flags and data for serialization.

func Deserialize

func Deserialize(data []byte) ([]RawBlob, error)

Deserialize results in the byte array being deserialised and separated into its respective interfaces.

func NewRawBlob

func NewRawBlob(i interface{}, skipEvm bool) (*RawBlob, error)

NewRawBlob builds a raw blob from any interface by using RLP encoding.

type SerializedBlob

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

SerializedBlob is a helper struct used by Deserialize to determine the total size of the data byte array

type Service

type Service interface {
	// Start spawns any goroutines required by the service.
	Start()
	// Stop terminates all goroutines belonging to the service,
	// blocking until they are all terminated.
	Stop() error
}

Service is a struct that can be registered into a ServiceRegistry for easy dependency management.

type ServiceRegistry

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

ServiceRegistry provides a useful pattern for managing services. It allows for ease of dependency management and ensures services dependent on others use the same references in memory.

func NewServiceRegistry

func NewServiceRegistry() *ServiceRegistry

NewServiceRegistry starts a registry instance for convenience

func (*ServiceRegistry) FetchService

func (s *ServiceRegistry) FetchService(service interface{}) error

FetchService takes in a struct pointer and sets the value of that pointer to a service currently stored in the service registry. This ensures the input argument is set to the right pointer that refers to the originally registered service.

func (*ServiceRegistry) RegisterService

func (s *ServiceRegistry) RegisterService(service Service) error

RegisterService appends a service constructor function to the service registry.

func (*ServiceRegistry) StartAll

func (s *ServiceRegistry) StartAll()

StartAll initialized each service in order of registration.

func (*ServiceRegistry) StopAll

func (s *ServiceRegistry) StopAll()

StopAll ends every service, logging a panic if any of them fail to stop.

Directories

Path Synopsis
Package debug defines useful profiling utils that came originally with go-ethereum.
Package debug defines useful profiling utils that came originally with go-ethereum.
This package exists to convert Ethererum 2.0 types to go-ethereum or Ethereum 1.0 types.
This package exists to convert Ethererum 2.0 types to go-ethereum or Ethereum 1.0 types.
Package p2p handles peer-to-peer networking for the sharding package.
Package p2p handles peer-to-peer networking for the sharding package.

Jump to

Keyboard shortcuts

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