Documentation ¶
Index ¶
- Constants
- Variables
- func DownloadFile(filepath string, url string) error
- func ReadMsg(r io.Reader) ([]byte, error)
- func ReleaseCompleted(steps []Step) bool
- func RestartByExec()
- func Run(ctx context.Context, opts Options) error
- func VerifySignature(payload string, requestSignature string, secret string) bool
- func WithLayout(layout func(*helpers.DagBuilderHelper) (ipldformat.Node, error)) func(n *DAGParams)
- func WriteMsg(w io.Writer, b []byte) error
- type Asset
- type CommArgs
- type CommResult
- type Command
- type CommandClient
- func (cc *CommandClient) Commit(args *CommArgs)
- func (cc *CommandClient) Get(args *GetArgs)
- func (cc *CommandClient) GotNotifyMsg(b []byte)
- func (cc *CommandClient) Import(args *ImportArgs)
- func (cc *CommandClient) List(args *ListArgs)
- func (cc *CommandClient) Off()
- func (cc *CommandClient) PayCollect(args *PayArgs)
- func (cc *CommandClient) PayList(args *PayArgs)
- func (cc *CommandClient) PaySettle(args *PayArgs)
- func (cc *CommandClient) PaySubmit(args *PayArgs)
- func (cc *CommandClient) PayTrack(args *PayArgs)
- func (cc *CommandClient) Ping(addr string)
- func (cc *CommandClient) Put(args *PutArgs)
- func (cc *CommandClient) SetNotifyCallback(fn func(Notify))
- func (cc *CommandClient) Status(args *StatusArgs)
- func (cc *CommandClient) WalletExport(args *WalletExportArgs)
- func (cc *CommandClient) WalletListKeys(args *WalletListArgs)
- func (cc *CommandClient) WalletPay(args *WalletPayArgs)
- type CommandServer
- type DAGOption
- type DAGParams
- type DealInfoArgs
- type DealInfoResult
- type GetArgs
- type GetResult
- type ImportArgs
- type ImportResult
- type ListArgs
- type ListResult
- type Notify
- type OffArgs
- type OffResult
- type Options
- type PayArgs
- type PayResult
- type PeeringService
- type PingArgs
- type PingResult
- type Pop
- func (nd *Pop) Add(ctx context.Context, dag ipldformat.DAGService, buf io.ReadSeeker, ...) (cid.Cid, error)
- func (nd *Pop) Commit(ctx context.Context, args *CommArgs)
- func (nd *Pop) DealInfo(ctx context.Context, args *DealInfoArgs) (DealInfoResult, error)
- func (nd *Pop) Get(ctx context.Context, args *GetArgs)
- func (nd *Pop) Import(ctx context.Context, args *ImportArgs)
- func (nd *Pop) List(ctx context.Context, args *ListArgs)
- func (nd *Pop) Load(ctx context.Context, args *GetArgs) (chan GetResult, error)
- func (nd *Pop) Off(ctx context.Context)
- func (nd *Pop) PayCollect(ctx context.Context, args *PayArgs)
- func (nd *Pop) PayList(ctx context.Context, args *PayArgs)
- func (nd *Pop) PaySettle(ctx context.Context, args *PayArgs)
- func (nd *Pop) PaySubmit(ctx context.Context, args *PayArgs)
- func (nd *Pop) PayTrack(ctx context.Context, args *PayArgs)
- func (nd *Pop) Ping(ctx context.Context, who string)
- func (nd *Pop) Put(ctx context.Context, args *PutArgs)
- func (nd *Pop) SetNotify(notify func(Notify))
- func (nd *Pop) Status(ctx context.Context, args *StatusArgs)
- func (nd *Pop) WalletExport(ctx context.Context, args *WalletExportArgs)
- func (nd *Pop) WalletList(ctx context.Context, args *WalletListArgs)
- func (nd *Pop) WalletPay(ctx context.Context, args *WalletPayArgs)
- type PutArgs
- type PutResult
- type RRecord
- type ReleaseDetails
- type ReleaseUpdate
- type RemoteIndex
- type StatusArgs
- type StatusResult
- type Step
- type WalletExportArgs
- type WalletListArgs
- type WalletPayArgs
- type WalletResult
- type WorkflowDetails
Constants ¶
const DhtPrefix = "/pop"
DhtPrefix sets a Pop prefix to be attached to the DHT protocols. For example: /pop/kad/1.0.0 instead of /ipfs/kad/1.0.0
const KContentBatch = "content-batch"
KContentBatch is the keystore used for storing the root CID of the HAMT used to aggregate content for storage
const MaxMessageSize = 10 << 20
MaxMessageSize is the maximum message size, in bytes.
const (
ReleaseURL = "https://api.github.com/repos/myelnet/pop/releases"
)
Variables ¶
var ( // ErrFilecoinRPCOffline is returned when the node is running without a provided filecoin api endpoint + token ErrFilecoinRPCOffline = errors.New("filecoin RPC is offline") // ErrAllDealsFailed is returned when all storage deals failed to get started ErrAllDealsFailed = errors.New("all deals failed") // ErrNoTx is returned when no transaction is staged and we attempt to commit ErrNoTx = errors.New("no tx to commit") // ErrNodeNotFound is returned when we cannot find the node in the given root ErrNodeNotFound = errors.New("node not found") // ErrQuoteNotFound is returned when we are trying to store but couldn't get a quote ErrQuoteNotFound = errors.New("quote not found") // ErrInvalidPeer is returned when trying to ping a peer with invalid peer ID or address ErrInvalidPeer = errors.New("invalid peer ID or address") // ErrCacheRFInvalid is returned if the cache RF is inconsistant with the specified peers ErrCacheRFInvalid = errors.New("Cache replication factor is smaller than specified peers") )
var ( // DefaultChunkSize is the default size a chunk DefaultChunkSize int64 = 128_000 // DefaultChunker is the default chunker of the DAG builder DefaultChunker = func(buf io.ReadSeeker) chunk.Splitter { return chunk.NewSizeSplitter(buf, DefaultChunkSize) } // DefaultLayout is the default layout of the DAG builder DefaultLayout = balanced.Layout )
var JsonEscapedZero = []byte(`\u0000`)
Functions ¶
func DownloadFile ¶
func ReleaseCompleted ¶
contains checks if a string is present in a slice
func VerifySignature ¶
func WithLayout ¶
func WithLayout(layout func(*helpers.DagBuilderHelper) (ipldformat.Node, error)) func(n *DAGParams)
WithLayout overrides the default dag layout with a layout function defining the overall layout of a DAG
Types ¶
type CommArgs ¶
type CommArgs struct { CacheRF int // CacheRF is the cache replication factor or number of cache provider will request Attempts int BackoffMin time.Duration Peers []string }
CommArgs are passed to the Commit command
type CommResult ¶
CommResult is feedback on the push operation
type Command ¶
type Command struct { Off *OffArgs Ping *PingArgs Put *PutArgs Status *StatusArgs WalletList *WalletListArgs WalletExport *WalletExportArgs WalletPay *WalletPayArgs Commit *CommArgs Get *GetArgs List *ListArgs Import *ImportArgs PaySubmit *PayArgs PayList *PayArgs PayTrack *PayArgs PaySettle *PayArgs PayCollect *PayArgs }
Command is a message sent from a client to the daemon
type CommandClient ¶
type CommandClient struct {
// contains filtered or unexported fields
}
CommandClient sends commands to a daemon process
func NewCommandClient ¶
func NewCommandClient(sendCommandMsg func(jsonb []byte)) *CommandClient
func (*CommandClient) Commit ¶
func (cc *CommandClient) Commit(args *CommArgs)
func (*CommandClient) Get ¶
func (cc *CommandClient) Get(args *GetArgs)
func (*CommandClient) GotNotifyMsg ¶
func (cc *CommandClient) GotNotifyMsg(b []byte)
func (*CommandClient) Import ¶
func (cc *CommandClient) Import(args *ImportArgs)
func (*CommandClient) List ¶
func (cc *CommandClient) List(args *ListArgs)
func (*CommandClient) Off ¶
func (cc *CommandClient) Off()
func (*CommandClient) PayCollect ¶
func (cc *CommandClient) PayCollect(args *PayArgs)
func (*CommandClient) PayList ¶
func (cc *CommandClient) PayList(args *PayArgs)
func (*CommandClient) PaySettle ¶
func (cc *CommandClient) PaySettle(args *PayArgs)
func (*CommandClient) PaySubmit ¶
func (cc *CommandClient) PaySubmit(args *PayArgs)
func (*CommandClient) PayTrack ¶
func (cc *CommandClient) PayTrack(args *PayArgs)
func (*CommandClient) Ping ¶
func (cc *CommandClient) Ping(addr string)
func (*CommandClient) Put ¶
func (cc *CommandClient) Put(args *PutArgs)
func (*CommandClient) SetNotifyCallback ¶
func (cc *CommandClient) SetNotifyCallback(fn func(Notify))
func (*CommandClient) Status ¶
func (cc *CommandClient) Status(args *StatusArgs)
func (*CommandClient) WalletExport ¶
func (cc *CommandClient) WalletExport(args *WalletExportArgs)
func (*CommandClient) WalletListKeys ¶
func (cc *CommandClient) WalletListKeys(args *WalletListArgs)
func (*CommandClient) WalletPay ¶
func (cc *CommandClient) WalletPay(args *WalletPayArgs)
type CommandServer ¶
type CommandServer struct {
// contains filtered or unexported fields
}
CommandServer receives commands on the daemon side and executes them
func NewCommandServer ¶
func NewCommandServer(node *Pop, sendNotifyMsg func(b []byte)) *CommandServer
func (*CommandServer) GotMsg ¶
func (cs *CommandServer) GotMsg(ctx context.Context, cmd *Command) error
func (*CommandServer) GotMsgBytes ¶
func (cs *CommandServer) GotMsgBytes(ctx context.Context, b []byte) error
type DAGOption ¶
type DAGOption func(*DAGParams)
DAGOption is a functional option overriding default DAG params
func WithChunker ¶
WithChunker overrides the default chunker with a given chunker interface
type DAGParams ¶
type DAGParams struct {
// contains filtered or unexported fields
}
DAGParams is a set of features used to chunk and format files into DAGs
func NewDAGParams ¶
func NewDAGParams(buf io.ReadSeeker) *DAGParams
NewDAGParams initializes default params for generating a DAG
type DealInfoArgs ¶
type DealInfoArgs struct {
CID cid.Cid
}
DealInfoArgs gives some params to find the deal
type DealInfoResult ¶
type DealInfoResult struct { Funds abi.TokenAmount PayCh address.Address }
DealInfoResult describes any ongoing deal
type GetArgs ¶
type GetArgs struct { Cid string `json:"cid"` Key string `json:"key,omitempty"` Sel string `json:"sel,omitempty"` Out string `json:"out,omitempty"` Timeout int `json:"timeout,omitempty"` Verbose bool `json:"verbose,omitempty"` Miner string `json:"miner,omitempty"` Peer string `json:"peer,omitempty"` Strategy string `json:"strategy,omitempty"` MaxPPB int64 `json:"maxPPB,omitempty"` ProviderAddr string `json:"providerAddr,omitempty"` Size int64 `json:"size,omitempty"` }
GetArgs get passed to the Get command
type GetResult ¶
type GetResult struct { Status string `json:"status,omitempty"` DealID string `json:"dealID,omitempty"` Size int64 `json:"size,omitempty"` TotalSpent string `json:"totalSpent,omitempty"` TotalReceived int64 `json:"totalReceived,omitempty"` BytesPaidFor string `json:"bytesPaidFor,omitempty"` TotalFunds string `json:"totalFunds,omitempty"` PricePerByte string `json:"pricePerByte,omitempty"` UnsealPrice string `json:"unsealPrice,omitempty"` DiscLatSeconds float64 `json:"discLatSeconds,omitempty"` TransLatSeconds float64 `json:"tansLatSeconds,omitempty"` Local bool `json:"local,omitempty"` Err string `json:"error,omitempty"` }
GetResult gives us feedback on the result of the Get request
type ImportArgs ¶
type ImportArgs struct { Path string CacheRF int Attempts int BackoffMin time.Duration Peers []string }
ImportArgs provides the path to the car file
type ImportResult ¶
ImportResult returns the resulting index entries from the CAR file
type ListArgs ¶
type ListArgs struct {
Page int // potential pagination as the amount may be very large
}
ListArgs provides params for the List command
type ListResult ¶
ListResult contains the result for a single item of the list
type Notify ¶
type Notify struct { OffResult *OffResult PingResult *PingResult PutResult *PutResult StatusResult *StatusResult WalletResult *WalletResult CommResult *CommResult GetResult *GetResult ListResult *ListResult ImportResult *ImportResult PayResult *PayResult }
Notify is a message sent from the daemon to the client
type Options ¶
type Options struct { // RepoPath is the file system path to use to persist our datastore RepoPath string // SocketPath is the unix socket path to listen on SocketPath string // Addresses allows setting custom listening addresses for the node Addresses []string // BootstrapPeers is a peer address to connect to for discovering other peers BootstrapPeers []string // FilEndpoint is the websocket url for accessing a remote filecoin api FilEndpoint string // FilToken is the authorization token to access the filecoin api FilToken string // PrivKey is a hex encoded private key to use for default address PrivKey string // MaxPPB is the maximum price per byte when fetching data MaxPPB int64 // PBB is the price per byte when serving data PPB int64 // Regions is a list of regions a provider chooses to support. // Nothing prevents providers from participating in regions outside of their geographic location however they may get less deals since the latency is likely to be higher Regions []string // Capacity is the maximum storage capacity dedicated to the exchange Capacity uint64 // ReplInterval defines how often the node attempts to find new content from connected peers ReplInterval time.Duration // Domains is a list of DNS names we can establish TLS handshakes with Domains []string // Certmagic flag activates certificate generation Certmagic bool // RemoteIndexURL is a url to send index records to RemoteIndexURL string // UpgradeSecret is used to verify automatic updates from a github webhook UpgradeSecret string // CancelFunc is used for gracefully shutting down the node CancelFunc context.CancelFunc }
Options determines configurations for the IPFS node
type PeeringService ¶
type PeeringService struct {
// contains filtered or unexported fields
}
PeeringService maintains connections to specified peers, reconnecting on disconnect with a back-off.
func NewPeeringService ¶
func NewPeeringService(host host.Host) *PeeringService
NewPeeringService constructs a new peering service. Peers can be added and removed immediately, but connections won't be formed until `Start` is called.
func (*PeeringService) AddPeer ¶
func (ps *PeeringService) AddPeer(info peer.AddrInfo)
AddPeer adds a peer to the peering service. This function may be safely called at any time: before the service is started, while running, or after it stops.
Add peer may also be called multiple times for the same peer. The new addresses will replace the old.
func (*PeeringService) ListPeers ¶
func (ps *PeeringService) ListPeers() []peer.AddrInfo
ListPeers lists peers in the peering service.
func (*PeeringService) RemovePeer ¶
func (ps *PeeringService) RemovePeer(id peer.ID)
RemovePeer removes a peer from the peering service. This function may be safely called at any time: before the service is started, while running, or after it stops.
func (*PeeringService) Start ¶
func (ps *PeeringService) Start() error
Start starts the peering service, connecting and maintaining connections to all registered peers. It returns an error if the service has already been stopped.
func (*PeeringService) Stop ¶
func (ps *PeeringService) Stop() error
Stop stops the peering service.
type PingResult ¶
type PingResult struct { ID string // Host's peer ID Addrs []string // Addresses the host is listening on Peers []string // Peers currently connected to the node (local daemon only) LatencySeconds float64 Version string // The Version the node is running Err string }
PingResult is sent in the notify message to give us the info we requested
type Pop ¶
Pop is the pop node implementation
func (*Pop) Add ¶
func (nd *Pop) Add(ctx context.Context, dag ipldformat.DAGService, buf io.ReadSeeker, opts ...DAGOption) (cid.Cid, error)
Add a buffer into the given DAG. These DAGs can eventually be put into transactions.
func (*Pop) DealInfo ¶
func (nd *Pop) DealInfo(ctx context.Context, args *DealInfoArgs) (DealInfoResult, error)
DealInfo returns info about any ongoing deals for a given CID
func (*Pop) Get ¶
Get sends a request for content with the given arguments. It also sends feedback to any open cli connections
func (*Pop) Import ¶
func (nd *Pop) Import(ctx context.Context, args *ImportArgs)
Import blocks from a CAR file
func (*Pop) Load ¶
Load is an RPC method that retrieves a given CID and key to the local blockstore. It sends feedback events to a result channel that it returns.
func (*Pop) PayCollect ¶
PayCollect sends a collect message for a given actor, validating before to make sure the channel is in the right state
func (*Pop) PaySettle ¶
PaySettle sends a settle message for a given actor and saves the time after which it can be collected
func (*Pop) PayTrack ¶
PayTrack the given channel loading the state from chain and adding it to the store currently only for inbound channels. Mostly for debugging purposes
func (*Pop) Status ¶
func (nd *Pop) Status(ctx context.Context, args *StatusArgs)
Status prints the current transaction status. It shows which files have been added but not yet committed to the network
func (*Pop) WalletExport ¶
func (nd *Pop) WalletExport(ctx context.Context, args *WalletExportArgs)
WalletExport writes the private key for a given address to a file at the given path
func (*Pop) WalletList ¶
func (nd *Pop) WalletList(ctx context.Context, args *WalletListArgs)
WalletList returns a list of all addresses for which we have the private keys
type PutResult ¶
type PutResult struct { RootCid string Key string Cid string Size int64 TotalSize string Len int Err string }
PutResult gives us feedback on the result of the Put request
type RRecord ¶
type RRecord struct { PeerAddr []byte PayAddr address.Address Size int64 Signature *crypto.Signature }
RRecord is a lightweight record to store as encoded bytes in a remote index
func (*RRecord) SigningBytes ¶
SigningBytes prepares the bytes for signing
type ReleaseDetails ¶
type ReleaseUpdate ¶
type ReleaseUpdate struct { Action string `json:"action"` Workflow WorkflowDetails `json:"workflow_job"` }
type RemoteIndex ¶
type RemoteIndex struct {
// contains filtered or unexported fields
}
RemoteIndex can publish cbor encoded records that a provider is storing a thing
func NewRemoteIndex ¶
func NewRemoteIndex(url string, h host.Host, w wallet.Driver, domains []string) (*RemoteIndex, error)
NewRemoteIndex creates a new index instance for the given wallet and host
func (*RemoteIndex) Delete ¶
func (ri *RemoteIndex) Delete(key cid.Cid) error
Delete a record when the content has been evicted from our store
func (*RemoteIndex) Publish ¶
func (ri *RemoteIndex) Publish(key cid.Cid, size int64) error
Publish a record to the remote url for a given cid
type StatusArgs ¶
type StatusArgs struct {
Verbose bool
}
StatusArgs get passed to the Status command
type StatusResult ¶
StatusResult gives us the result of status request to ping
type WalletExportArgs ¶
WalletExportArgs get passed to the WalletExport command
type WalletListArgs ¶
type WalletListArgs struct{}
WalletListArgs get passed to the WalletList command
type WalletPayArgs ¶
WalletPayArgs get passed to the WalletPay command
type WalletResult ¶
WalletResult returns the output of every WalletList/WalletExport/WalletPay requests