client

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: 21 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Blockchain

type Blockchain interface {
	// executor operation
	GetExecutorNodeByID(id string) (blockchain.ExecutorNode, error)
	GetExecutorNodeByName(name string) (blockchain.ExecutorNode, error)
	ListExecutorNodes() (blockchain.ExecutorNodes, error)

	// task operation
	ListTask(opt *blockchain.ListFLTaskOptions) (blockchain.FLTasks, error)
	PublishTask(opt *blockchain.PublishFLTaskOptions) error
	StartTask(opt *blockchain.StartFLTaskOptions) error
	GetTaskById(id string) (blockchain.FLTask, error)

	// file operation
	GetFileByID(id string) (xdbchain.File, error)
	ListFileAuthApplications(opt *xdbchain.ListFileAuthOptions) (xdbchain.FileAuthApplications, error)
	GetAuthApplicationByID(authID string) (xdbchain.FileAuthApplication, error)
}

Blockchain defines some contract methods

type Client

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

Client requester client, used to publish task and retrieve task result

func GetRequestClient

func GetRequestClient(configPath string) (*Client, error)

GetRequestClient returns client for Requester by blockchain configuration

func (*Client) GetExecutorNodeByID

func (c *Client) GetExecutorNodeByID(pubkeyStr string) (node blockchain.ExecutorNode, err error)

GetExecutorNodeByID get the executor node by nodeID, which is the public key of the node

func (*Client) GetExecutorNodeByName

func (c *Client) GetExecutorNodeByName(name string) (node blockchain.ExecutorNode, err error)

GetExecutorNodeByName get executor node by nodeName

func (*Client) GetFileAuthByID

func (c *Client) GetFileAuthByID(id string) (fileAuth xdbchain.FileAuthApplication, err error)

GetFileAuthByID get file authorization application detail by authID

func (*Client) GetPredictResult

func (c *Client) GetPredictResult(privateKey, taskID, output string) (err error)

GetPredictResult gets predict result by taskID output is the path to save predict result

func (*Client) GetTaskById

func (c *Client) GetTaskById(id string) (t blockchain.FLTask, err error)

GetTaskById gets task by taskID

func (*Client) ListExecutorNodes

func (c *Client) ListExecutorNodes() (nodes blockchain.ExecutorNodes, err error)

ListExecutorNodes list all executor nodes

func (*Client) ListFileAuthApplications

func (c *Client) ListFileAuthApplications(opt *xdbchain.ListFileAuthOptions) (fileAuths xdbchain.FileAuthApplications, err error)

ListFileAuthApplications query the list of authorization applications

func (*Client) ListTask

func (c *Client) ListTask(rPubkeyStr, ePubkeyStr, status string, start, end,
	limit int64) (tasks blockchain.FLTasks, err error)

ListTask lists tasks by requester or executor's public key hex string support listing tasks a requester published or tasks an executor involved status is task status to search only task published after "start" before "end" will be listed limit is the maximum number of tasks to response

func (*Client) Publish

func (c *Client) Publish(opt PublishOptions) (taskId string, err error)

Publish publishes a task, returns taskID

func (*Client) StartTask

func (c *Client) StartTask(privateKey, id string) (err error)

StartTask starts task by taskID, only task with 'Ready' status can be started

type PublishOptions

type PublishOptions struct {
	PrivateKey  string           // requester private key
	Files       string           // file list with "," as delimiter, used for training or prediction
	Executors   string           // executor nodes with "," as delimiter, used for executing a training or prediction task
	TaskName    string           // task name, not unique for one requester
	AlgoParam   pbCom.TaskParams // parameters required for training or prediction
	PSILabels   string           // ID feature name list with "," as delimiter, used for PSI
	Description string           // task description
}

PublishOptions define parameters used to publishing a task

Jump to

Keyboard shortcuts

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