Documentation ¶
Overview ¶
Package ipfs implements fs.FS wrappers around various IPFS APIS.
Index ¶
- Constants
- func WithContext[OT generic.OptionFunc[T], T any, I contextSetter[T]](ctx context.Context) OT
- func WithPermissions[OT generic.OptionFunc[T], T any, I permissionSetter[T]](permissions fs.FileMode) OT
- type IPFS
- type IPFSGuest
- type IPFSOption
- type IPNS
- type IPNSGuest
- type IPNSOption
- type KeyFS
- type KeyFSGuest
- type KeyFSOption
- type PinFS
- type PinFSGuest
- type PinFSOption
Constants ¶
const IPFSID filesystem.ID = "IPFS"
const IPNSID filesystem.ID = "IPNS"
const KeyFSID filesystem.ID = "KeyFS"
const PinFSID filesystem.ID = "PinFS"
Variables ¶
This section is empty.
Functions ¶
func WithContext ¶
func WithContext[ OT generic.OptionFunc[T], T any, I contextSetter[T], ](ctx context.Context, ) OT
func WithPermissions ¶
func WithPermissions[ OT generic.OptionFunc[T], T any, I permissionSetter[T], ](permissions fs.FileMode, ) OT
Types ¶
type IPFS ¶
type IPFS struct {
// contains filtered or unexported fields
}
func (*IPFS) ID ¶
func (*IPFS) ID() filesystem.ID
type IPFSGuest ¶
type IPFSGuest struct { APIMaddr multiaddr.Multiaddr `json:"apiMaddr,omitempty"` APITimeout time.Duration `json:"apiTimeout,omitempty"` NodeCacheCount int `json:"nodeCacheCount,omitempty"` DirectoryCacheCount int `json:"directoryCacheCount,omitempty"` }
func (*IPFSGuest) GuestID ¶
func (*IPFSGuest) GuestID() filesystem.ID
func (*IPFSGuest) ParseField ¶
func (*IPFSGuest) UnmarshalJSON ¶
type IPFSOption ¶
type IPFSOption func(*ipfsSettings) error
func WithDirectoryCacheCount ¶
func WithDirectoryCacheCount(cacheCount int) IPFSOption
WithDirectoryCacheCount sets the number of directory entry-lists the file system will hold in its cache. If <= 0, caching of entries is disabled.
func WithNodeCacheCount ¶
func WithNodeCacheCount(cacheCount int) IPFSOption
WithNodeCacheCount sets the number of IPLD nodes the file system will hold in its cache. If <= 0, caching of nodes is disabled.
func WithNodeTimeout ¶
func WithNodeTimeout(duration time.Duration) IPFSOption
WithNodeTimeout sets a timeout duration to use when communicating with the IPFS API/node. If <= 0, operations will not time out, and will remain pending until the file system is closed.
type IPNS ¶
type IPNS struct {
// contains filtered or unexported fields
}
func (*IPNS) ID ¶
func (*IPNS) ID() filesystem.ID
type IPNSGuest ¶
func (*IPNSGuest) GuestID ¶
func (*IPNSGuest) GuestID() filesystem.ID
func (*IPNSGuest) ParseField ¶
func (*IPNSGuest) UnmarshalJSON ¶
type IPNSOption ¶
type IPNSOption func(*ipnsSettings) error
func CacheNodesFor ¶
func CacheNodesFor(duration time.Duration) IPNSOption
CacheNodesFor sets how long a node is considered valid within the cache. After this time, the node will be refreshed during its next operation.
func WithRootCache ¶
func WithRootCache(cacheCount int) IPNSOption
WithRootCache sets the number of root names to cache. Roots will be resolved and held in the cache until they expire or this count is exceeded. If <=0, caching of names is disabled.
type KeyFS ¶
type KeyFS struct {
// contains filtered or unexported fields
}
func (*KeyFS) ID ¶
func (*KeyFS) ID() filesystem.ID
type KeyFSGuest ¶
type KeyFSGuest struct{ IPNSGuest }
func (*KeyFSGuest) GuestID ¶
func (*KeyFSGuest) GuestID() filesystem.ID
type KeyFSOption ¶
func WithIPNS ¶
func WithIPNS(ipns fs.FS) KeyFSOption
type PinFS ¶
type PinFS struct {
// contains filtered or unexported fields
}
func (*PinFS) ID ¶
func (*PinFS) ID() filesystem.ID
type PinFSGuest ¶
func (*PinFSGuest) GuestID ¶
func (*PinFSGuest) GuestID() filesystem.ID
func (*PinFSGuest) ParseField ¶
func (pg *PinFSGuest) ParseField(key, value string) error
func (*PinFSGuest) UnmarshalJSON ¶
func (pg *PinFSGuest) UnmarshalJSON(b []byte) error
type PinFSOption ¶
func CachePinsFor ¶
func CachePinsFor(duration time.Duration) PinFSOption
func WithIPFS ¶
func WithIPFS(ipfs fs.FS) PinFSOption
WithIPFS supplies an IPFS instance to use for added functionality. One such case is resolving a pin's file metadata.