types

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Aug 20, 2019 License: BSD-3-Clause Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrInvalidLengthTypes = fmt.Errorf("proto: negative length found during unmarshaling")
	ErrIntOverflowTypes   = fmt.Errorf("proto: integer overflow")
)

Functions

func FormatStringers

func FormatStringers(separator string, stringers ...interface{}) string

FormatStringers formats the given stringers into one string using the given separator

func ParseStringLoaders

func ParseStringLoaders(csv, separator string, stringLoaders ...interface{}) (err error)

ParseStringLoaders splits the given string into the given separator and loads each part into a given string loader.

Types

type BytesLoader

type BytesLoader interface {
	LoadBytes([]byte) error
}

BytesLoader loads a byte slice and uses it as the (parsed) value.

type CoinOutput

type CoinOutput struct {
	State       CoinOutputState
	UnlockHash  types.UnlockHash
	CoinValue   types.Currency
	LockType    LockType
	LockValue   types.LockValue
	Description string
}

CoinOutput is used to store all spent/unspent coin outputs in the custom CSV format (used internally only)

func (CoinOutput) Bytes

func (co CoinOutput) Bytes() []byte

Bytes returns a binary representation of a CoinOutput, using Rivine's binary encoding package (github.com/threefoldtech/rivine/pkg/encoding/siabin).

func (*CoinOutput) LoadBytes

func (co *CoinOutput) LoadBytes(b []byte) error

LoadBytes decodes the given bytes using the binary representation of a CoinOutput, making use of Rivine's binary encoding package (github.com/threefoldtech/rivine/pkg/encoding/siabin) to decode, the previously encoded CoinOutput.

func (*CoinOutput) LoadString

func (co *CoinOutput) LoadString(str string) error

LoadString implements StringLoader.LoadString

func (CoinOutput) String

func (co CoinOutput) String() string

String implements Stringer.String

type CoinOutputLock

type CoinOutputLock struct {
	CoinOutputID types.CoinOutputID
	LockValue    types.LockValue
}

CoinOutputLock is used to store the lock value and a reference to its parent CoinOutput, as to store the lock in a scoped bucket.

func (*CoinOutputLock) LoadString

func (col *CoinOutputLock) LoadString(str string) error

LoadString implements StringLoader.LoadString

func (CoinOutputLock) String

func (col CoinOutputLock) String() string

String implements Stringer.String

type CoinOutputState

type CoinOutputState uint8

CoinOutputState represents the state of a coin output.

const (
	CoinOutputStateNil CoinOutputState = iota
	CoinOutputStateLiquid
	CoinOutputStateLocked
	CoinOutputStateSpent
)

The different states a coin output can be in.

func (CoinOutputState) Byte

func (cos CoinOutputState) Byte() byte

Byte returns this CoinOutputState as a byte

func (*CoinOutputState) DecodeMsg

func (z *CoinOutputState) DecodeMsg(dc *msgp.Reader) (err error)

DecodeMsg implements msgp.Decodable

func (CoinOutputState) EncodeMsg

func (z CoinOutputState) EncodeMsg(en *msgp.Writer) (err error)

EncodeMsg implements msgp.Encodable

func (*CoinOutputState) LoadString

func (cos *CoinOutputState) LoadString(str string) error

LoadString implements StringLoader.LoadString

func (CoinOutputState) MarshalSia

func (cos CoinOutputState) MarshalSia(w io.Writer) error

MarshalSia implements rivine/encoding.MarshalSia

func (CoinOutputState) Msgsize

func (z CoinOutputState) Msgsize() (s int)

Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message

func (CoinOutputState) String

func (cos CoinOutputState) String() string

String implements Stringer.String

func (*CoinOutputState) UnmarshalSia

func (cos *CoinOutputState) UnmarshalSia(r io.Reader) error

UnmarshalSia implements rivine/encoding.UnmarshalSia

type ExplorerState

type ExplorerState struct {
	CurrentChangeID types.ConsensusChangeID `json:"currentchangeid" msg:"ccid"`
	NextThreeBotID  types.BotID             `json:"nextthreebotid" msg:"nbid"`
}

ExplorerState collects the (internal) state for the explorer.

func NewExplorerState

func NewExplorerState() ExplorerState

NewExplorerState creates a nil (fresh) explorer state.

func (*ExplorerState) DecodeMsg

func (z *ExplorerState) DecodeMsg(dc *msgp.Reader) (err error)

DecodeMsg implements msgp.Decodable

func (*ExplorerState) EncodeMsg

func (z *ExplorerState) EncodeMsg(en *msgp.Writer) (err error)

EncodeMsg implements msgp.Encodable

func (*ExplorerState) Msgsize

func (z *ExplorerState) Msgsize() (s int)

Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message

func (ExplorerState) ProtocolBufferMarshal

func (state ExplorerState) ProtocolBufferMarshal(w encoding.ProtocolBufferWriter) error

ProtocolBufferMarshal implements encoding.ProtocolBufferMarshaler.ProtocolBufferMarshal using the generated code based on the PBExplorerState Message defined in ./types.proto

func (*ExplorerState) ProtocolBufferUnmarshal

func (state *ExplorerState) ProtocolBufferUnmarshal(r encoding.ProtocolBufferReader) error

ProtocolBufferUnmarshal implements encoding.ProtocolBufferUnmarshaler.ProtocolBufferUnmarshal using the generated code based on the PBExplorerState Message defined in ./types.proto

type LockType

type LockType uint8

LockType represents the type of a lock, used to lock a (coin) output.

const (
	LockTypeNone LockType = iota
	LockTypeHeight
	LockTypeTime
)

The different types of locks used to lock (coin) outputs.

func (*LockType) DecodeMsg

func (z *LockType) DecodeMsg(dc *msgp.Reader) (err error)

DecodeMsg implements msgp.Decodable

func (LockType) EncodeMsg

func (z LockType) EncodeMsg(en *msgp.Writer) (err error)

EncodeMsg implements msgp.Encodable

func (*LockType) LoadString

func (lt *LockType) LoadString(str string) error

LoadString implements StringLoader.LoadString

func (LockType) MarshalSia

func (lt LockType) MarshalSia(w io.Writer) error

MarshalSia implements rivine/encoding.MarshalSia

func (LockType) Msgsize

func (z LockType) Msgsize() (s int)

Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message

func (LockType) String

func (lt LockType) String() string

String implements Stringer.String

func (*LockType) UnmarshalSia

func (lt *LockType) UnmarshalSia(r io.Reader) error

UnmarshalSia implements rivine/encoding.UnmarshalSia

type NetworkInfo

type NetworkInfo struct {
	ChainName   string `json:"chainName" msg:"cn"`
	NetworkName string `json:"networkName" msg:"nn"`
}

NetworkInfo defines the info of the chain network data is dumped from, used as to prevent name colissions.

func (*NetworkInfo) DecodeMsg

func (z *NetworkInfo) DecodeMsg(dc *msgp.Reader) (err error)

DecodeMsg implements msgp.Decodable

func (NetworkInfo) EncodeMsg

func (z NetworkInfo) EncodeMsg(en *msgp.Writer) (err error)

EncodeMsg implements msgp.Encodable

func (NetworkInfo) Msgsize

func (z NetworkInfo) Msgsize() (s int)

Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message

func (NetworkInfo) ProtocolBufferMarshal

func (info NetworkInfo) ProtocolBufferMarshal(w encoding.ProtocolBufferWriter) error

ProtocolBufferMarshal implements encoding.ProtocolBufferMarshaler.ProtocolBufferMarshal using the generated code based on the PBExplorerState Message defined in ./types.proto

func (*NetworkInfo) ProtocolBufferUnmarshal

func (info *NetworkInfo) ProtocolBufferUnmarshal(r encoding.ProtocolBufferReader) error

ProtocolBufferUnmarshal implements encoding.ProtocolBufferUnmarshaler.ProtocolBufferUnmarshal using the generated code based on the PBExplorerState Message defined in ./types.proto

type PBExplorerState

type PBExplorerState struct {
	CurrentConsensusChangeId []byte `protobuf:"bytes,1,req,name=current_consensus_change_id,json=currentConsensusChangeId" json:"current_consensus_change_id"`
	NextThreebotId           uint32 `protobuf:"varint,2,opt,name=next_threebot_id,json=nextThreebotId" json:"next_threebot_id"`
}

ExplorerState collects the (internal) state for the explorer.

func (*PBExplorerState) Descriptor

func (*PBExplorerState) Descriptor() ([]byte, []int)

func (*PBExplorerState) GetCurrentConsensusChangeId

func (m *PBExplorerState) GetCurrentConsensusChangeId() []byte

func (*PBExplorerState) GetNextThreebotId added in v0.3.0

func (m *PBExplorerState) GetNextThreebotId() uint32

func (*PBExplorerState) Marshal

func (m *PBExplorerState) Marshal() (dAtA []byte, err error)

func (*PBExplorerState) MarshalTo

func (m *PBExplorerState) MarshalTo(dAtA []byte) (int, error)

func (*PBExplorerState) ProtoMessage

func (*PBExplorerState) ProtoMessage()

func (*PBExplorerState) Reset

func (m *PBExplorerState) Reset()

func (*PBExplorerState) Size

func (m *PBExplorerState) Size() (n int)

func (*PBExplorerState) String

func (m *PBExplorerState) String() string

func (*PBExplorerState) Unmarshal

func (m *PBExplorerState) Unmarshal(dAtA []byte) error

func (*PBExplorerState) XXX_DiscardUnknown

func (m *PBExplorerState) XXX_DiscardUnknown()

func (*PBExplorerState) XXX_Marshal

func (m *PBExplorerState) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*PBExplorerState) XXX_Merge

func (dst *PBExplorerState) XXX_Merge(src proto.Message)

func (*PBExplorerState) XXX_Size

func (m *PBExplorerState) XXX_Size() int

func (*PBExplorerState) XXX_Unmarshal

func (m *PBExplorerState) XXX_Unmarshal(b []byte) error

type PBNetworkInfo

type PBNetworkInfo struct {
	ChainName   string `protobuf:"bytes,1,req,name=chain_name,json=chainName" json:"chain_name"`
	NetworkName string `protobuf:"bytes,2,req,name=network_name,json=networkName" json:"network_name"`
}

NetworkInfo defines the info of the chain network data is dumped from, used as to prevent name colissions.

func (*PBNetworkInfo) Descriptor

func (*PBNetworkInfo) Descriptor() ([]byte, []int)

func (*PBNetworkInfo) GetChainName

func (m *PBNetworkInfo) GetChainName() string

func (*PBNetworkInfo) GetNetworkName

func (m *PBNetworkInfo) GetNetworkName() string

func (*PBNetworkInfo) Marshal

func (m *PBNetworkInfo) Marshal() (dAtA []byte, err error)

func (*PBNetworkInfo) MarshalTo

func (m *PBNetworkInfo) MarshalTo(dAtA []byte) (int, error)

func (*PBNetworkInfo) ProtoMessage

func (*PBNetworkInfo) ProtoMessage()

func (*PBNetworkInfo) Reset

func (m *PBNetworkInfo) Reset()

func (*PBNetworkInfo) Size

func (m *PBNetworkInfo) Size() (n int)

func (*PBNetworkInfo) String

func (m *PBNetworkInfo) String() string

func (*PBNetworkInfo) Unmarshal

func (m *PBNetworkInfo) Unmarshal(dAtA []byte) error

func (*PBNetworkInfo) XXX_DiscardUnknown

func (m *PBNetworkInfo) XXX_DiscardUnknown()

func (*PBNetworkInfo) XXX_Marshal

func (m *PBNetworkInfo) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*PBNetworkInfo) XXX_Merge

func (dst *PBNetworkInfo) XXX_Merge(src proto.Message)

func (*PBNetworkInfo) XXX_Size

func (m *PBNetworkInfo) XXX_Size() int

func (*PBNetworkInfo) XXX_Unmarshal

func (m *PBNetworkInfo) XXX_Unmarshal(b []byte) error

type StringLoader

type StringLoader interface {
	LoadString(string) error
}

StringLoader loads a string and uses it as the (parsed) value.

Jump to

Keyboard shortcuts

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