Documentation ¶
Index ¶
- Constants
- func NewDriverFromParams(params DriverParameters) (storagedriver.StorageDriver, error)
- func Wrap(d *IpfsDriver) storagedriver.StorageDriver
- type Driver
- type DriverParameters
- type IpfsDriver
- func (s *IpfsDriver) Close() error
- func (s *IpfsDriver) Delete(ctx context.Context, path string) error
- func (s *IpfsDriver) GetContent(ctx context.Context, path string) ([]byte, error)
- func (s *IpfsDriver) List(ctx context.Context, subPath string) ([]string, error)
- func (s *IpfsDriver) Move(ctx context.Context, sourcePath string, destPath string) error
- func (s *IpfsDriver) Name() string
- func (s *IpfsDriver) PutContent(ctx context.Context, path string, content []byte) (retErr error)
- func (s *IpfsDriver) Reader(ctx context.Context, path string, offset int64) (io.ReadCloser, error)
- func (s *IpfsDriver) Stat(ctx context.Context, path string) (storagedriver.FileInfo, error)
- func (s *IpfsDriver) URLFor(ctx context.Context, path string, options map[string]interface{}) (string, error)
- func (s *IpfsDriver) Walk(ctx context.Context, path string, f storagedriver.WalkFn) error
- func (s *IpfsDriver) Writer(ctx context.Context, path string, append bool) (w storagedriver.FileWriter, retErr error)
Constants ¶
const (
DriverName = "ipfs"
)
Variables ¶
This section is empty.
Functions ¶
func NewDriverFromParams ¶
func NewDriverFromParams(params DriverParameters) (storagedriver.StorageDriver, error)
func Wrap ¶
func Wrap(d *IpfsDriver) storagedriver.StorageDriver
Types ¶
type DriverParameters ¶
type DriverParameters struct { // IpfsApiAddress is the address of the ipfs node's api port. // In multi address format. // `ipfsapiaddress` in the yaml IpfsApiAddress string // IPNS key to write to our MFS root to. `writeipnskey` in yaml. WriteIpnsKey string // Optional list of IPNS keys to read other MFS roots. // This allows you to specify the IPNS key of a remote node, and // share the images of that node. Thus enabling p2p registries. // `readonlyipnskeys` in yaml. ReadOnlyKeys []string }
type IpfsDriver ¶
type IpfsDriver struct {
// contains filtered or unexported fields
}
IpfsDriver implements the storagedriver.StorageDriver interface
func NewDriverFromAPI ¶
func (*IpfsDriver) Close ¶
func (s *IpfsDriver) Close() error
func (*IpfsDriver) Delete ¶
func (s *IpfsDriver) Delete(ctx context.Context, path string) error
Delete recursively deletes all objects stored at "path" and its subpaths.
func (*IpfsDriver) GetContent ¶
GetContent retrieves the content stored at "path" as a []byte. This should primarily be used for small objects.
func (*IpfsDriver) List ¶
List returns a list of the objects that are direct descendants of the given path.
func (*IpfsDriver) Move ¶
Move moves an object stored at sourcePath to destPath, removing the original object. Note: This may be no more efficient than a copy followed by a delete for many implementations.
func (*IpfsDriver) Name ¶
func (s *IpfsDriver) Name() string
Name returns the human-readable "name" of the driver, useful in error messages and logging. By convention, this will just be the registration name, but drivers may provide other information here.
func (*IpfsDriver) PutContent ¶
PutContent stores the []byte content at a location designated by "path". This should primarily be used for small objects.
func (*IpfsDriver) Reader ¶
func (s *IpfsDriver) Reader(ctx context.Context, path string, offset int64) (io.ReadCloser, error)
Reader retrieves an io.ReadCloser for the content stored at "path" with a given byte offset. May be used to resume reading a stream by providing a nonzero offset.
func (*IpfsDriver) Stat ¶
func (s *IpfsDriver) Stat(ctx context.Context, path string) (storagedriver.FileInfo, error)
Stat retrieves the FileInfo for the given path, including the current size in bytes and the creation time.
func (*IpfsDriver) URLFor ¶
func (s *IpfsDriver) URLFor(ctx context.Context, path string, options map[string]interface{}) (string, error)
URLFor returns a URL which may be used to retrieve the content stored at the given path, possibly using the given options. May return an ErrUnsupportedMethod in certain StorageDriver implementations.
func (*IpfsDriver) Walk ¶
func (s *IpfsDriver) Walk(ctx context.Context, path string, f storagedriver.WalkFn) error
Walk traverses a filesystem defined within driver, starting from the given path, calling f on each file. If the returned error from the WalkFn is ErrSkipDir and fileInfo refers to a directory, the directory will not be entered and Walk will continue the traversal. If fileInfo refers to a normal file, processing stops
func (*IpfsDriver) Writer ¶
func (s *IpfsDriver) Writer(ctx context.Context, path string, append bool) (w storagedriver.FileWriter, retErr error)
Writer returns a FileWriter which will store the content written to it at the location designated by "path" after the call to Commit.