http

package
v0.0.0-...-ebe581b Latest Latest
Warning

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

Go to latest
Published: Mar 22, 2024 License: Apache-2.0 Imports: 13 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	// contains filtered or unexported fields
}

func New

func New(addr string) (Client, error)

New new a client by server address

func (*Client) AddFileNs

func (c *Client) AddFileNs(ctx context.Context, owner, priKey, ns, des string, replica int) error

AddFileNs add a file namespace

func (*Client) ConfirmOrRejectAuth

func (c *Client) ConfirmOrRejectAuth(ctx context.Context, opt ConfirmAuthOptions) error

ConfirmOrRejectAuth confirm or reject applier's file authorization application by opt.Status

func (*Client) GetAuth

func (c *Client) GetAuth(ctx context.Context, authID string) (blockchain.FileAuthApplication, error)

GetAuth get file authorization application detail by authID

func (*Client) GetChallengeByID

func (c *Client) GetChallengeByID(ctx context.Context, id string) (blockchain.Challenge, error)

GetChallengeByID get challenge info by challenge id

func (*Client) GetChallenges

func (c *Client) GetChallenges(ctx context.Context, opt GetChallengesOptions, status string) ([]blockchain.Challenge, error)

GetChallenges get challenges with status "ToProve" or "Proved" or "Failed"

func (*Client) GetFileByID

func (c *Client) GetFileByID(ctx context.Context, id string) (blockchain.FileH, error)

GetFileByID get file info by file id

func (*Client) GetFileByName

func (c *Client) GetFileByName(ctx context.Context, owner, ns, name string) (blockchain.FileH, error)

GetFileByName get file info by file name, owner and namespace

func (*Client) GetFileSysHealth

func (c *Client) GetFileSysHealth(ctx context.Context, owner string) (blockchain.FileSysHealth, error)

GetFileSysHealth get system health status of an owner

func (*Client) GetMigrateRecords

func (c *Client) GetMigrateRecords(ctx context.Context, id string, start, end int64, limit int64) ([]map[string]interface{}, error)

GetMigrateRecords get storage node migrate records

func (*Client) GetNode

func (c *Client) GetNode(ctx context.Context, id string) (blockchain.Node, error)

GetNode get storage node by node id

func (*Client) GetNodeHealth

func (c *Client) GetNodeHealth(ctx context.Context, id string) (string, error)

GetNodeHealth get storage node health status by node id

func (*Client) GetNodeHeartbeat

func (c *Client) GetNodeHeartbeat(ctx context.Context, id string, ctime int64) (map[string]int, error)

GetNodeHeartbeat get storage node heart beat number

func (*Client) GetNsByName

func (c *Client) GetNsByName(ctx context.Context, owner, ns string) (blockchain.NamespaceH, error)

GetNsByName get namespace by name and owner

func (*Client) ListFileAuths

ListFileAuths get the list of file authorization applications

func (*Client) ListFileNs

func (c *Client) ListFileNs(ctx context.Context, opt ListNsOptions) ([]blockchain.Namespace, error)

ListFileNs list file namespaces

func (*Client) ListFiles

func (c *Client) ListFiles(ctx context.Context, opt ListFileOptions, isExpired bool) ([]blockchain.File, error)

ListFiles list unexpired files

func (*Client) ListNodes

func (c *Client) ListNodes(ctx context.Context) (blockchain.Nodes, error)

ListNodes list all storage nodes in system

func (*Client) NodeOffline

func (c *Client) NodeOffline(ctx context.Context, privkey string) error

NodeOffline set storage node status offline

func (*Client) NodeOnline

func (c *Client) NodeOnline(ctx context.Context, privkey string) error

NodeOnline set storage node status online

func (*Client) Read

func (c *Client) Read(ctx context.Context, opt ReadOptions) (io.ReadCloser, error)

Read download a file

func (*Client) UpdateExpTimeByID

func (c *Client) UpdateExpTimeByID(ctx context.Context, id, privateKey string, expireTime int64) error

UpdateExpTimeByID update file expire time by file id

func (*Client) UpdateFileNsReplica

func (c *Client) UpdateFileNsReplica(ctx context.Context, priKey, ns string, replica int) error

UpdateFileNsReplica update namespace replica

func (*Client) Write

Write upload a file

type ConfirmAuthOptions

type ConfirmAuthOptions struct {
	PrivateKey   string
	AuthID       string
	ExpireTime   int64
	RejectReason string
	Status       bool
}

ConfirmAuthOptions define parameters for authorizers to confirm the file authorization application

type GetChallengesOptions

type GetChallengesOptions struct {
	Owner      string
	TargetNode string
	FileID     string // optional, filter

	TimeStart int64
	TimeEnd   int64
	Limit     int64
}

GetChallengesOptions support paging query

type ListFileAuthOptions

type ListFileAuthOptions struct {
	Owner     string
	Applier   string
	FileID    string
	Status    string
	TimeStart int64
	TimeEnd   int64
	Limit     int64
}

ListFileAuthOptions define parameters for authorizers or appliers to query the list of file authorization application

type ListFileOptions

type ListFileOptions struct {
	Owner     string
	Namespace string

	TimeStart int64
	TimeEnd   int64
	Limit     int64
}

ListFileOptions support paging query

type ListNsOptions

type ListNsOptions struct {
	Owner string

	TimeStart int64
	TimeEnd   int64
	Limit     int64
}

ListNsOptions support paging query

type ReadOptions

type ReadOptions struct {
	PrivateKey string

	Namespace string
	FileName  string

	FileID string
}

ReadOptions download files using FileID or Namespace+FileName

type WriteOptions

type WriteOptions struct {
	PrivateKey string

	Namespace   string
	FileName    string
	ExpireTime  int64
	Description string
	Extra       string
}

WriteOptions define the parameters required to upload the file

Jump to

Keyboard shortcuts

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