nodeid

package
v0.0.0-...-12ab560 Latest Latest
Warning

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

Go to latest
Published: Jun 29, 2021 License: Apache-2.0 Imports: 7 Imported by: 6

Documentation

Overview

Package nodeid - combines common operation on FileCoin NodeID.

NodeID is a unique identifier for a node, participating in FileCoin network operations. Example of the node might be a Retrieval Gateway or a Retrieval Provider.

Index

Constants

View Source
const WordSize = 32 // the NodeID length is 32 bytes.

Variables

This section is empty.

Functions

func MapNodeIDToString

func MapNodeIDToString(cids []NodeID) []string

Map - used to returns a new slice containing CIDs as string values

Types

type NodeID

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

NodeID represents a NodeID.

func MapStringToNodeID

func MapStringToNodeID(cids []string) []NodeID

Map - used to returns a new slice containing CIDs as string values

func NewNodeID

func NewNodeID(id *big.Int) (*NodeID, error)

NewNodeID creates a NodeID object.

func NewNodeIDFromBytes

func NewNodeIDFromBytes(id []byte) (*NodeID, error)

NewNodeIDFromBytes creates a NodeID object.

func NewNodeIDFromHexString

func NewNodeIDFromHexString(id string) (*NodeID, error)

NewNodeIDFromHexString creates a NodeID from a string.

func NewNodeIDFromPublicKey

func NewNodeIDFromPublicKey(pubKey *fcrcrypto.KeyPair) (*NodeID, error)

NewNodeIDFromPublicKey create a NodeID based on a public key.

func NewRandomNodeID

func NewRandomNodeID() *NodeID

NewRandomNodeID creates a random NodeID object.

func SortClockwise

func SortClockwise(nodeID *NodeID, nodeIDs []*NodeID) []*NodeID

SortClockwise sort nodeIDs in clockwise mode starting on nodeID

func (*NodeID) AsBytes32

func (n *NodeID) AsBytes32() (result [WordSize]byte)

AsBytes32 returns the NodeID as a [32]byte.

func (NodeID) MarshalJSON

func (n NodeID) MarshalJSON() ([]byte, error)

MarshalJSON is used to marshal NodeID into bytes.

func (*NodeID) ToBytes

func (n *NodeID) ToBytes() []byte

ToBytes returns the byte array representation of the NodeID.

func (*NodeID) ToString

func (n *NodeID) ToString() string

ToString returns a string for the NodeID.

func (*NodeID) UnmarshalJSON

func (n *NodeID) UnmarshalJSON(p []byte) error

UnmarshalJSON is used to unmarshal bytes into NodeID.

Jump to

Keyboard shortcuts

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