Documentation
¶
Index ¶
- type IpfsClient
- func (c *IpfsClient) AddAndPinFile(ctx context.Context, msg proto.Message) (string, error)
- func (c *IpfsClient) AddAndPinFileBytes(ctx context.Context, byteArray []byte) (string, error)
- func (c *IpfsClient) AddFile(ctx context.Context, msg proto.Message) (string, error)
- func (c *IpfsClient) AddFileBytes(ctx context.Context, byteArray []byte) (string, error)
- func (c *IpfsClient) GetFile(ctx context.Context, cid string, msg proto.Message) error
- func (c *IpfsClient) PinFile(ctx context.Context, cid string) error
- func (c *IpfsClient) UnpinFile(ctx context.Context, cid string) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type IpfsClient ¶
IpfsClient is a wrapper around the IPFS node HTTP API. It provides convenient methods for interacting with the IPFS node.
func NewIpfsClient ¶
func NewIpfsClient(configPath string) (*IpfsClient, error)
NewIpfsClient creates a new IpfsClient instance.
func (*IpfsClient) AddAndPinFile ¶
AddAndPinFile adds a protobuf message to IPFS and pins it.
func (*IpfsClient) AddAndPinFileBytes ¶
AddAndPinFileBytes adds a byte array to the IPFS and pins it.
func (*IpfsClient) AddFileBytes ¶
AddFileBytes adds a byte array to IPFS and returns its CID.
func (*IpfsClient) GetFile ¶
GetFile retrieves a protobuf message from IPFS, unmarshals it and leaves the result in msg.
func (*IpfsClient) PinFile ¶
func (c *IpfsClient) PinFile(ctx context.Context, cid string) error
PinFile pins a CID to the local IPFS node. Without pinning, the data related to the CID will be stored in the IPFS but will get deleted by the garbage collector later on. Pinning the CID will prevent this from happening.