Documentation
¶
Index ¶
- Constants
- func CalculateAPICallCost(callType string, privateNetwork bool) (float64, error)
- func CalculateFileCost(holdTimeInMonths, size int64, privateNetwork bool) float64
- func CalculateGarbageCollectDate(holdTimeInMonths int) time.Time
- func CalculatePinCost(contentHash string, holdTimeInMonths int64, im rtfs.Manager, ...) (float64, error)
- func FloatToBigInt(val float64) *big.Int
- func GenerateMultiAddrFromString(addr string) (ma.Multiaddr, error)
- func ParseMultiAddrForIPFSPeer(address ma.Multiaddr) (bool, error)
- func ParsePeerIDFromIPFSMultiAddr(address ma.Multiaddr) (string, error)
- func RetrieveUsdPrice(coin string) (float64, error)
- type RandomUtils
- type Response
Constants ¶
const ( // UsdPerGigaBytePerMonthPublic is the usd cost of storing a gigabyte of data in public networks for a month UsdPerGigaBytePerMonthPublic = 0.134 // UsdPerGigaBytePerMonthPrivate is the usd cost of storing a gigabyte of data in private networks for a month UsdPerGigaBytePerMonthPrivate = 0.154 // PubSubPublishPublic is the of cost of sending a pubsub message to the public ipfs network PubSubPublishPublic = 0.01 // PubSubPublishPrivate is the cost of sending a pubsub message to a private ipfs network PubSubPublishPrivate = 0.02 // IPNSPublishPublic is the cost of publishing an IPNS record to the public ipfs network IPNSPublishPublic = 5.00 // IPNSPublishPrivate is the cost of publishing an IPNS record to the a private ipfs network IPNSPublishPrivate = 10.00 // RSAKeyCreationPublic is the cost of creating an rsa key on the public ipfs network RSAKeyCreationPublic = 2.00 // RSAKeyCreationPrivate is the cost of creating an rsa key on a private ifps network RSAKeyCreationPrivate = 2.50 // EDKeyCreationPublic is the cost of creating an ed25519 key on the public ipfs network EDKeyCreationPublic = 1.00 // EDKeyCreationPrivate is the cost of creating an ed25519 key on a private ipfs network EDKeyCreationPrivate = 1.50 )
prices listed here are temporary and will be changed
const (
// LetterBytes are the letters of an alphabet used to generate a random number
LetterBytes = "abcdefghijklmnopqrstuvwxyz"
)
Variables ¶
This section is empty.
Functions ¶
func CalculateAPICallCost ¶
CalculateAPICallCost is used to calculate the cost associated with an API call, that isn't related to uploads/pinning
func CalculateFileCost ¶
CalculateFileCost is used to calculate the cost of storing a file
func CalculateGarbageCollectDate ¶
CalculateGarbageCollectDate is used to calculate the date at which data is removed from our system
func CalculatePinCost ¶
func CalculatePinCost(contentHash string, holdTimeInMonths int64, im rtfs.Manager, privateNetwork bool) (float64, error)
CalculatePinCost is used to calculate the cost of pining a particular content hash
func FloatToBigInt ¶
FloatToBigInt used to convert a float to big int
func GenerateMultiAddrFromString ¶
GenerateMultiAddrFromString is used to take a string, and convert it to a multiformat based address
func ParseMultiAddrForIPFSPeer ¶
ParseMultiAddrForIPFSPeer is used to parse a multiaddress to determine whether its a valid ipfs address
func ParsePeerIDFromIPFSMultiAddr ¶
ParsePeerIDFromIPFSMultiAddr is used to parse a multiaddress and extract the IPFS peer id
func RetrieveUsdPrice ¶
RetrieveUsdPrice is used to retrieve the USD price for a coin from CMC
Types ¶
type RandomUtils ¶
RandomUtils is our helper struct for random related utilities
func GenerateRandomUtils ¶
func GenerateRandomUtils() *RandomUtils
GenerateRandomUtils is used to generate our random utils struct
func (*RandomUtils) GenerateString ¶
func (u *RandomUtils) GenerateString(length int, charset string) string
GenerateString is used to generate a fixed length random string from the specified charset, using a fresh seed each time
type Response ¶
type Response struct {
ID string `json:"id"`
Name string `json:"name"`
Symbol string `json:"symbol"`
Rank string `json:"rank"`
PriceUsd string `json:"price_usd"`
PriceBtc string `json:"price_btc"`
TwentyFourHrVolume string `json:"24h_volume_usd"`
MarketCapUsd string `json:"market_cap_usd"`
AvailableSupply string `json:"available_supply"`
TotalSupply string `json:"total_supply"`
MaxSupply string `json:"null"`
PercentChange1h string `json:"percent_change_1h"`
PercentChange24h string `json:"percent_change_24h"`
PercentChange7d string `json:"percent_change_7d"`
LastUpdate string `json:"last_updated"`
}
Response used to hold response data from cmc