Documentation
¶
Overview ¶
Package cid - provides methods for ContentID struct.
ContentID is 32 bytes is a unique identifier of a file stored in a Filecoin blockchain network.
Package cid - provides methods for ContentIDAdapter struct.
ContentIDAdapter is 32 bytes is a unique identifier of a file stored in a Filecoin blockchain network.
Index ¶
Constants ¶
const WordSize = 32 // the ContentID length is 32 bytes.
Variables ¶
This section is empty.
Functions ¶
func MapCIDToString ¶
Map - used to returns a new slice containing CIDs as string values
Types ¶
type ContentID ¶
type ContentID struct {
// contains filtered or unexported fields
}
ContentID represents a CID.
func MapStringToCID ¶
Map - used to returns a new slice containing CIDs as string values
func NewContentID ¶
NewContentID creates a ContentID object.
func NewContentIDFromBytes ¶
NewContentIDFromBytes creates a ContentID object from bytes array.
func NewContentIDFromHexString ¶
NewContentIDFromHexString creates a ContentID object from hex string.
func NewRandomContentID ¶
func NewRandomContentID() *ContentID
NewRandomContentID creates a random ContentID object.
func (ContentID) CalculateHash ¶
CalculateHash hashes the values of a ContentID.
func (ContentID) Equals ¶
func (n ContentID) Equals(other merkletree.Content) (bool, error)
Equals tests for equality of two ContentIDs.
func (ContentID) MarshalJSON ¶
MarshalJSON is used to marshal CID into bytes.
func (*ContentID) UnmarshalJSON ¶
UnmarshalJSON is used to unmarshal bytes into ContentID.
type ContentIDAdapter ¶
type ContentIDAdapter struct {
Id string
}
ContentIDAdapter represents a CID.
func (ContentIDAdapter) CalculateHash ¶
func (n ContentIDAdapter) CalculateHash() ([]byte, error)
CalculateHash hashes the values of a ContentIDAdapter.
func (ContentIDAdapter) Equals ¶
func (n ContentIDAdapter) Equals(other merkletree.Content) (bool, error)
Equals tests for equality of two Contents
func (*ContentIDAdapter) ToString ¶
func (n *ContentIDAdapter) ToString() string
ToString returns a string for the ContentID.