Documentation ¶
Index ¶
- Variables
- func GetClientTrace(traceMsg, metricPrefix, ruid string, tn *time.Time) *httptrace.ClientTrace
- type Client
- func (c *Client) CreateFeedWithManifest(request *feed.Request) (string, error)
- func (c *Client) Download(hash, path string) (*File, error)
- func (c *Client) DownloadDirectory(hash, path, destDir, credentials string) error
- func (c *Client) DownloadFile(hash, path, dest, credentials string) error
- func (c *Client) DownloadManifest(hash string) (*api.Manifest, bool, error)
- func (c *Client) DownloadRaw(hash string) (io.ReadCloser, bool, error)
- func (c *Client) GetFeedRequest(query *feed.Query, manifestAddressOrDomain string) (*feed.Request, error)
- func (c *Client) List(hash, prefix, credentials string) (*api.ManifestList, error)
- func (c *Client) MultipartUpload(hash string, uploader Uploader) (string, error)
- func (c *Client) QueryFeed(query *feed.Query, manifestAddressOrDomain string) (io.ReadCloser, error)
- func (c *Client) TarUpload(hash string, uploader Uploader, defaultPath string, toEncrypt bool) (string, error)
- func (c *Client) UpdateFeed(request *feed.Request) error
- func (c *Client) Upload(file *File, manifest string, toEncrypt bool) (string, error)
- func (c *Client) UploadDirectory(dir, defaultPath, manifest string, toEncrypt bool) (string, error)
- func (c *Client) UploadManifest(m *api.Manifest, toEncrypt bool) (string, error)
- func (c *Client) UploadRaw(r io.Reader, size int64, toEncrypt bool) (string, error)
- type DirectoryUploader
- type File
- type FileUploader
- type UploadFn
- type Uploader
- type UploaderFunc
Constants ¶
This section is empty.
Variables ¶
var ErrNoFeedUpdatesFound = errors.New("No updates found for this feed")
当Swarm找不到给定源的更新时,返回errnoFeedUpdatesFund。
var (
)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 (*Client) CreateFeedWithManifest ¶
CreateFeedWithManifest创建源清单,并使用提供的 数据 返回可用于包含在ENS解析程序(setcontent)中的结果源清单地址。 或引用将来的更新(client.updatefeed)
func (*Client) DownloadDirectory ¶
下载目录下载群清单中包含的文件 到本地目录的给定路径(现有文件将被覆盖)
func (*Client) DownloadFile ¶
下载文件将单个文件下载到目标目录中 如果清单项未指定文件名-它将回退 以文件名的形式传递到文件的哈希
func (*Client) DownloadManifest ¶
下载清单下载群清单
func (*Client) DownloadRaw ¶
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 ¶
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) Upload ¶
上载将文件上载到Swarm,并将其添加到现有清单中 (如果manifest参数非空)或创建包含 文件,返回生成的清单哈希(然后该文件将 可在bzz:/<hash>/<path>)获取
func (*Client) UploadDirectory ¶
uploadDirectory将目录树上载到swarm并添加文件 到现有清单(如果清单参数非空)或创建 新清单,返回生成的清单哈希(来自 目录将在bzz:/<hash>/path/to/file处可用,其中 默认路径中指定的文件正在上载到清单的根目录 (即bzz/<hash>/)
func (*Client) UploadManifest ¶
上载清单将给定清单上载到Swarm
type DirectoryUploader ¶
type DirectoryUploader struct {
Dir string
}
DirectoryUploader上载目录中的所有文件,可以选择上载 默认路径的文件
func (*DirectoryUploader) Upload ¶
func (d *DirectoryUploader) Upload(upload UploadFn) error
上载执行目录和默认路径的上载
type UploaderFunc ¶
func (UploaderFunc) Upload ¶
func (u UploaderFunc) Upload(upload UploadFn) error