powergate: github.com/textileio/powergate/util Index | Files

package util

import "github.com/textileio/powergate/util"

Index

Package Files

util.go

Constants

const (
    // EpochDurationSeconds is the expected duration in seconds of an epoch.
    // Defined at the filecoin spec level.
    EpochDurationSeconds = 30

    // MinDealDuration is the minium deal duration accepted in the Filecoin network.
    // Original calculation: 180 * EpochsInADay
    MinDealDuration = 180 * (24 * 60 * 60 / EpochDurationSeconds)

    // CidUndef is a magic value to represent an undefined cid as a string.
    CidUndef = "CID_UNDEF"

    // DefaultCidUndef is the string generated by the cid module's String() func for an undefined cid.
    DefaultCidUndef = "b"
)

Variables

var (
    // AvgBlockTime is the expected duration between block in two consecutive epochs.
    AvgBlockTime = time.Second * time.Duration(EpochDurationSeconds)
)

func CidFromString Uses

func CidFromString(c string) (cid.Cid, error)

CidFromString converts a string to a cid assuming that an empty string is cid.Undef.

func CidToString Uses

func CidToString(c cid.Cid) string

CidToString converts a cid to string, representing cid.Undef as an empty string.

func MustParseAddr Uses

func MustParseAddr(str string) ma.Multiaddr

MustParseAddr returns a parsed Multiaddr, or panics if invalid.

func TCPAddrFromMultiAddr Uses

func TCPAddrFromMultiAddr(maddr ma.Multiaddr) (string, error)

TCPAddrFromMultiAddr converts a multiaddress to a string representation of a tcp address.

Package util imports 6 packages (graph) and is imported by 45 packages. Updated 2020-09-21. Refresh now. Tools for package owners.