client

package
v0.0.0-...-39cdb81 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 21, 2019 License: GPL-3.0 Imports: 25 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrNoFeedUpdatesFound = errors.New("No updates found for this feed")

当Swarm找不到给定源的更新时,返回errnoFeedUpdatesFund。

View Source
var (
	ErrUnauthorized = errors.New("unauthorized")
)

Functions

func GetClientTrace

func GetClientTrace(traceMsg, metricPrefix, ruid string, tn *time.Time) *httptrace.ClientTrace

Types

type Client

type Client struct {
	Gateway string
}

客户端将与Swarm HTTP网关的交互进行包装。

func NewClient

func NewClient(gateway string) *Client

func (*Client) CreateFeedWithManifest

func (c *Client) CreateFeedWithManifest(request *feed.Request) (string, error)

CreateFeedWithManifest创建源清单,并使用提供的 数据 返回可用于包含在ENS解析程序(setcontent)中的结果源清单地址。 或引用将来的更新(client.updatefeed)

func (*Client) Download

func (c *Client) Download(hash, path string) (*File, error)

下载从swarm manifest下载具有给定路径的文件 给定的哈希(即它得到bzz:/<hash>/<path>)

func (*Client) DownloadDirectory

func (c *Client) DownloadDirectory(hash, path, destDir, credentials string) error

下载目录下载群清单中包含的文件 到本地目录的给定路径(现有文件将被覆盖)

func (*Client) DownloadFile

func (c *Client) DownloadFile(hash, path, dest, credentials string) error

下载文件将单个文件下载到目标目录中 如果清单项未指定文件名-它将回退 以文件名的形式传递到文件的哈希

func (*Client) DownloadManifest

func (c *Client) DownloadManifest(hash string) (*api.Manifest, bool, error)

下载清单下载群清单

func (*Client) DownloadRaw

func (c *Client) DownloadRaw(hash string) (io.ReadCloser, bool, error)

downloadraw从swarm下载原始数据,它返回readcloser和bool 内容已加密

func (*Client) GetFeedRequest

func (c *Client) GetFeedRequest(query *feed.Query, manifestAddressOrDomain string) (*feed.Request, error)

GetFeedRequest返回一个描述引用的源状态的结构 ManifestAddressOrDomain是您在CreateFeedWithManifest或其解析程序的ENS域中获得的地址。 指向那个地址

func (*Client) List

func (c *Client) List(hash, prefix, credentials string) (*api.ManifestList, error)

列出具有给定前缀、分组的群清单中的列表文件 使用“/”作为分隔符的常见前缀。

例如,如果清单表示以下目录结构:

文件1.TXT 文件2.TXT DRI1/FIL3.TXT dir1/dir2/file4.txt文件

然后:

-前缀“”将返回[dir1/,file1.txt,file2.txt] -前缀“file”将返回[file1.txt,file2.txt] -前缀“dir1/”将返回[dir1/dir2/,dir1/file3.txt]

其中以“/”结尾的条目是常见的前缀。

func (*Client) MultipartUpload

func (c *Client) MultipartUpload(hash string, uploader Uploader) (string, error)

multipartupload使用给定的上载程序将文件作为 多部分表单,返回结果清单哈希

func (*Client) QueryFeed

func (c *Client) QueryFeed(query *feed.Query, manifestAddressOrDomain string) (io.ReadCloser, error)

queryfeed返回具有源更新的原始内容的字节流 ManifestAddressOrDomain是您在CreateFeedWithManifest或其解析程序的ENS域中获得的地址。 指向那个地址

func (*Client) TarUpload

func (c *Client) TarUpload(hash string, uploader Uploader, defaultPath string, toEncrypt bool) (string, error)

tar upload使用给定的上传器将文件作为tar流上传到swarm, 返回结果清单哈希

func (*Client) UpdateFeed

func (c *Client) UpdateFeed(request *feed.Request) error

更新源允许您设置内容的新版本

func (*Client) Upload

func (c *Client) Upload(file *File, manifest string, toEncrypt bool) (string, error)

上载将文件上载到Swarm,并将其添加到现有清单中 (如果manifest参数非空)或创建包含 文件,返回生成的清单哈希(然后该文件将 可在bzz:/<hash>/<path>)获取

func (*Client) UploadDirectory

func (c *Client) UploadDirectory(dir, defaultPath, manifest string, toEncrypt bool) (string, error)

uploadDirectory将目录树上载到swarm并添加文件 到现有清单(如果清单参数非空)或创建 新清单,返回生成的清单哈希(来自 目录将在bzz:/<hash>/path/to/file处可用,其中 默认路径中指定的文件正在上载到清单的根目录 (即bzz/<hash>/)

func (*Client) UploadManifest

func (c *Client) UploadManifest(m *api.Manifest, toEncrypt bool) (string, error)

上载清单将给定清单上载到Swarm

func (*Client) UploadRaw

func (c *Client) UploadRaw(r io.Reader, size int64, toEncrypt bool) (string, error)

uploadraw将原始数据上载到swarm并返回结果哈希。如果加密是真的 上载加密数据

type DirectoryUploader

type DirectoryUploader struct {
	Dir string
}

DirectoryUploader上载目录中的所有文件,可以选择上载 默认路径的文件

func (*DirectoryUploader) Upload

func (d *DirectoryUploader) Upload(upload UploadFn) error

上载执行目录和默认路径的上载

type File

type File struct {
	io.ReadCloser
	api.ManifestEntry
}

文件表示群清单中的文件,用于上传和 从Swarm下载内容

func Open

func Open(path string) (*File, error)

打开打开一个本地文件,然后可以将其传递到客户端。上载以上载 它蜂拥而至

type FileUploader

type FileUploader struct {
	File *File
}

文件上载程序上载单个文件

func (*FileUploader) Upload

func (f *FileUploader) Upload(upload UploadFn) error

上载执行文件上载

type UploadFn

type UploadFn func(file *File) error

uploadfn是传递给上载程序以执行上载的函数类型。 对于单个文件(例如,目录上载程序将调用 目录树中每个文件的uploadfn)

type Uploader

type Uploader interface {
	Upload(UploadFn) error
}

上载程序使用提供的上载将文件上载到Swarm fn

type UploaderFunc

type UploaderFunc func(UploadFn) error

func (UploaderFunc) Upload

func (u UploaderFunc) Upload(upload UploadFn) error

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL