blockchain

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

Documentation

Index

Constants

View Source
const (
	/* Define Task Status stored in Contract */
	TaskConfirming = "Confirming" // waiting for Executors to confirm
	TaskReady      = "Ready"      // has been confirmed by all Executors, and ready to start
	TaskToProcess  = "ToProcess"  // has started, and waiting to be precessed
	TaskProcessing = "Processing" // under process, that's during training or predicting
	TaskFinished   = "Finished"   // task finished
	TaskFailed     = "Failed"     // task failed
	TaskRejected   = "Rejected"   // task rejected by one of the Executors

	/* Define Task Type stored in Contract */
	TaskTypeTrain   = "train"   // training task
	TaskTypePredict = "predict" // prediction task

	/* Define Algorithms stored in Contract */
	AlgorithmVLine = "linear-vl"       // linear regression with multiple variables in vertical federated learning
	AlgorithmVLog  = "logistic-vl"     // logistic regression with multiple variables in vertical federated learning
	AlgorithmVDnn  = "dnn-paddlefl-vl" // dnn implemented using paddlefl

	/* Define Regularization stored in Contract */
	RegModeL1 = "l1" // L1-norm
	RegModeL2 = "l2" // L2-norm

	/* Define the maximum number of task list query */
	TaskListMaxNum = 100
)

Variables

RegModeListName the mapping of train regMode name and value

RegModeListValue the mapping of train regMode value and name

TaskTypeListName the mapping of train task type name and value key is the task type name of the training task or prediction task

TaskTypeListValue the mapping of train task type value and name key is the int value of the training task or prediction task

VlAlgorithmListName the mapping of vertical algorithm name and value

VlAlgorithmListValue the mapping of vertical algorithm value and name key is the int value of the algorithm

Functions

This section is empty.

Types

type AddNodeOptions

type AddNodeOptions struct {
	Node      ExecutorNode `json:"node"`
	Signature []byte       `json:"signature"`
}

AddNodeOptions contains parameters for adding node of Executor

type ExecutorNode

type ExecutorNode struct {
	ID              []byte `json:"id"`
	Name            string `json:"name"`
	Address         string `json:"address"`     // local grpc host
	HttpAddress     string `json:"httpAddress"` // local http host
	PaddleFLAddress string `json:"paddleFLAddress"`
	PaddleFLRole    int    `json:"paddleFLRole"`
	RegTime         int64  `json:"regTime"` // node registering time
}

ExecutorNode has access to samples with which to train models or to predict,

and starts task that multi parties execute synchronically

type ExecutorNodes

type ExecutorNodes []ExecutorNode

type FLInfo

type FLInfo struct {
	FileType  string `json:"fileType"`  // file type, only supports "csv"
	Features  string `json:"features"`  // feature list
	TotalRows int64  `json:"totalRows"` // total number of samples
}

FLInfo used to parse the content contained in the extra field of the file on the chain, only files that can be parsed can be used for task training or prediction

type FLTask

type FLTask *pbTask.FLTask

FLTask defines Federated Learning Task based on MPC

type FLTaskConfirmOptions

type FLTaskConfirmOptions struct {
	Pubkey       []byte `json:"pubkey"` // one of the task executor's public key
	TaskID       string `json:"taskID"`
	RejectReason string `json:"rejectReason"` // reason of the rejected task
	CurrentTime  int64  `json:"currentTime"`  // time when confirming task

	Signature []byte `json:"signature"` // executor's signature
}

FLTaskConfirmOptions contains parameters for confirming task

type FLTaskExeStatusOptions

type FLTaskExeStatusOptions struct {
	Executor    []byte `json:"executor"`
	TaskID      string `json:"taskID"`
	CurrentTime int64  `json:"currentTime"` // task execute start time or finish time

	Signature []byte `json:"signature"`

	ErrMessage string `json:"errMessage"` // for failed task
	Result     string `json:"result"`     // for finished task
}

FLTaskExeStatusOptions contains parameters for updating executing task

type FLTasks

type FLTasks []*pbTask.FLTask

type ListFLTaskOptions

type ListFLTaskOptions struct {
	PubKey     []byte `json:"pubKey"`    // requester's public key
	ExecPubKey []byte `json:"exePubKey"` // executor's public key
	Status     string `json:"status"`    // task status
	TimeStart  int64  `json:"timeStart"` // task publish time period, only task published after TimeStart and before TimeEnd will be listed
	TimeEnd    int64  `json:"timeEnd"`
	Limit      int64  `json:"limit"` // limit number of tasks in list request, default 'all'
}

ListFLTaskOptions contains parameters for listing tasks support listing tasks a requester published or tasks an executor involved

type PublishFLTaskOptions

type PublishFLTaskOptions struct {
	FLTask    FLTask `json:"fLTask"`
	Signature []byte `json:"signature"`
}

PublishFLTaskOptions contains parameters for publishing tasks

type StartFLTaskOptions

type StartFLTaskOptions struct {
	TaskID    string `json:"taskID"`
	Signature []byte `json:"signature"`
}

StartFLTaskOptions contains parameters for the requester to start tasks

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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