Documentation ¶
Index ¶
- Constants
- Variables
- func DefaultGfBsDB(config *config.SQLDBConfig)
- func DefaultGfBsDBOption(app *GfSpBaseApp, cfg *gfspconfig.GfSpConfig) error
- func DefaultGfSpClientOption(app *GfSpBaseApp, cfg *gfspconfig.GfSpConfig) error
- func DefaultGfSpConsensusOption(app *GfSpBaseApp, cfg *gfspconfig.GfSpConfig) error
- func DefaultGfSpDBOption(app *GfSpBaseApp, cfg *gfspconfig.GfSpConfig) error
- func DefaultGfSpMetricOption(app *GfSpBaseApp, cfg *gfspconfig.GfSpConfig) error
- func DefaultGfSpModulusOption(app *GfSpBaseApp, cfg *gfspconfig.GfSpConfig) error
- func DefaultGfSpPieceOpOption(app *GfSpBaseApp, cfg *gfspconfig.GfSpConfig) error
- func DefaultGfSpPieceStoreOption(app *GfSpBaseApp, cfg *gfspconfig.GfSpConfig) error
- func DefaultGfSpPprofOption(app *GfSpBaseApp, cfg *gfspconfig.GfSpConfig) error
- func DefaultGfSpResourceManagerOption(app *GfSpBaseApp, cfg *gfspconfig.GfSpConfig) error
- func DefaultGfSpTQueueOption(app *GfSpBaseApp, cfg *gfspconfig.GfSpConfig) error
- func DefaultGrpcServerOptions() []grpc.ServerOption
- func DefaultStaticOption(app *GfSpBaseApp, cfg *gfspconfig.GfSpConfig) error
- func GetRegisterModulus() []string
- func GetRegisterModulusDescription() string
- func RegisterModular(name string, description string, newFunc NewModularFunc)
- func RpcRemoteAddress(ctx context.Context) string
- type GfSpBaseApp
- func (g *GfSpBaseApp) AppID() string
- func (g *GfSpBaseApp) Consensus() consensus.Consensus
- func (g *GfSpBaseApp) Done() <-chan struct{}
- func (g *GfSpBaseApp) EnableMetrics() bool
- func (g *GfSpBaseApp) GetAuthNonce(ctx context.Context, req *gfspserver.GetAuthNonceRequest) (*gfspserver.GetAuthNonceResponse, error)
- func (g *GfSpBaseApp) GfBsDB() bsdb.BSDB
- func (g *GfSpBaseApp) GfBsDBBackup() bsdb.BSDB
- func (g *GfSpBaseApp) GfBsDBMaster() bsdb.BSDB
- func (g *GfSpBaseApp) GfSpAskApproval(ctx context.Context, req *gfspserver.GfSpAskApprovalRequest) (*gfspserver.GfSpAskApprovalResponse, error)
- func (g *GfSpBaseApp) GfSpAskSecondaryReplicatePieceApproval(ctx context.Context, ...) (*gfspserver.GfSpAskSecondaryReplicatePieceApprovalResponse, error)
- func (g *GfSpBaseApp) GfSpAskTask(ctx context.Context, req *gfspserver.GfSpAskTaskRequest) (*gfspserver.GfSpAskTaskResponse, error)
- func (g *GfSpBaseApp) GfSpBeginTask(ctx context.Context, req *gfspserver.GfSpBeginTaskRequest) (*gfspserver.GfSpBeginTaskResponse, error)
- func (g *GfSpBaseApp) GfSpClient() *gfspclient.GfSpClient
- func (g *GfSpBaseApp) GfSpDB() spdb.SPDB
- func (g *GfSpBaseApp) GfSpDoneReplicatePiece(ctx context.Context, req *gfspserver.GfSpDoneReplicatePieceRequest) (*gfspserver.GfSpDoneReplicatePieceResponse, error)
- func (g *GfSpBaseApp) GfSpDownloadObject(ctx context.Context, req *gfspserver.GfSpDownloadObjectRequest) (*gfspserver.GfSpDownloadObjectResponse, error)
- func (g *GfSpBaseApp) GfSpGetChallengeInfo(ctx context.Context, req *gfspserver.GfSpGetChallengeInfoRequest) (*gfspserver.GfSpGetChallengeInfoResponse, error)
- func (g *GfSpBaseApp) GfSpQueryP2PBootstrap(ctx context.Context, req *gfspserver.GfSpQueryP2PNodeRequest) (*gfspserver.GfSpQueryP2PNodeResponse, error)
- func (g *GfSpBaseApp) GfSpQueryResourceLimit(context.Context, *gfspserver.GfSpQueryResourceLimitRequest) (*gfspserver.GfSpQueryResourceLimitResponse, error)
- func (g *GfSpBaseApp) GfSpQueryTasks(ctx context.Context, req *gfspserver.GfSpQueryTasksRequest) (*gfspserver.GfSpQueryTasksResponse, error)
- func (g *GfSpBaseApp) GfSpReplicatePiece(ctx context.Context, req *gfspserver.GfSpReplicatePieceRequest) (*gfspserver.GfSpReplicatePieceResponse, error)
- func (g *GfSpBaseApp) GfSpReportTask(ctx context.Context, req *gfspserver.GfSpReportTaskRequest) (*gfspserver.GfSpReportTaskResponse, error)
- func (g *GfSpBaseApp) GfSpSetResourceLimit(context.Context, *gfspserver.GfSpSetResourceLimitRequest) (*gfspserver.GfSpSetResourceLimitResponse, error)
- func (g *GfSpBaseApp) GfSpSign(ctx context.Context, req *gfspserver.GfSpSignRequest) (*gfspserver.GfSpSignResponse, error)
- func (g *GfSpBaseApp) GfSpUploadObject(stream gfspserver.GfSpUploadService_GfSpUploadObjectServer) error
- func (g *GfSpBaseApp) GfSpVerifyAuthorize(ctx context.Context, req *gfspserver.GfSpAuthorizeRequest) (*gfspserver.GfSpAuthorizeResponse, error)
- func (g *GfSpBaseApp) OnAskCreateBucketApproval(ctx context.Context, task task.ApprovalCreateBucketTask) (bool, error)
- func (g *GfSpBaseApp) OnAskCreateObjectApproval(ctx context.Context, task task.ApprovalCreateObjectTask) (bool, error)
- func (g *GfSpBaseApp) OnAskTask(ctx context.Context, limit corercmgr.Limit) (coretask.Task, error)
- func (g *GfSpBaseApp) OnBeginUploadObjectTask(ctx context.Context, task coretask.UploadObjectTask) error
- func (g *GfSpBaseApp) OnChallengePieceTask(ctx context.Context, task task.ChallengePieceTask) ([]byte, [][]byte, []byte, error)
- func (g *GfSpBaseApp) OnDownloadObjectTask(ctx context.Context, task task.DownloadObjectTask) ([]byte, error)
- func (g *GfSpBaseApp) OperateAddress() string
- func (g *GfSpBaseApp) PieceOp() piecestore.PieceOp
- func (g *GfSpBaseApp) PieceStore() piecestore.PieceStore
- func (g *GfSpBaseApp) RegisterServices(services ...corelifecycle.Service)
- func (g *GfSpBaseApp) ResourceManager() corercmgr.ResourceManager
- func (g *GfSpBaseApp) ServerForRegister() *grpc.Server
- func (g *GfSpBaseApp) SetGfBsDB(setDB bsdb.BSDB) bsdb.BSDB
- func (g *GfSpBaseApp) Signals(sigs ...os.Signal) corelifecycle.Lifecycle
- func (g *GfSpBaseApp) Start(ctx context.Context) error
- func (g *GfSpBaseApp) StartRpcServer(ctx context.Context) error
- func (g *GfSpBaseApp) StartServices(ctx context.Context) corelifecycle.Lifecycle
- func (g *GfSpBaseApp) StopRpcServer(ctx context.Context) error
- func (g *GfSpBaseApp) StopServices(ctx context.Context)
- func (g *GfSpBaseApp) TaskMaxRetry(task coretask.Task) int64
- func (g *GfSpBaseApp) TaskPriority(task coretask.Task) coretask.TPriority
- func (g *GfSpBaseApp) TaskPriorityLevel(task coretask.Task) coretask.TPriorityLevel
- func (g *GfSpBaseApp) TaskTimeout(task coretask.Task, size uint64) int64
- func (g *GfSpBaseApp) UpdateUserPublicKey(ctx context.Context, req *gfspserver.UpdateUserPublicKeyRequest) (*gfspserver.UpdateUserPublicKeyResponse, error)
- func (g *GfSpBaseApp) VerifyOffChainSignature(ctx context.Context, req *gfspserver.VerifyOffChainSignatureRequest) (*gfspserver.VerifyOffChainSignatureResponse, error)
- func (g *GfSpBaseApp) Wait(ctx context.Context)
- type ModularManager
- type NewModularFunc
- type Option
Constants ¶
const ( // DefaultGfSpAppIDPrefix defines the default app id prefix. DefaultGfSpAppIDPrefix = "gfsp" // DefaultGrpcAddress defines the default Grpc address. DefaultGrpcAddress = "localhost:9333" // DefaultMetricsAddress defines the default metrics service address. DefaultMetricsAddress = "localhost:24367" // DefaultPprofAddress defines the default pprof service address. DefaultPprofAddress = "localhost:24368" // DefaultChainID defines the default greenfield chain ID. DefaultChainID = "greenfield_9000-1741" // DefaultChainAddress defines the default greenfield address. DefaultChainAddress = "http://localhost:26750" // DefaultMemoryLimit defines the default memory limit for resource manager. DefaultMemoryLimit = 8 * 1024 * 1024 * 1024 // DefaultTaskTotalLimit defines the default total task limit for resource manager. DefaultTaskTotalLimit = 10240 // DefaultHighTaskLimit defines the default high priority task limit for resource manager. DefaultHighTaskLimit = 128 // DefaultMediumTaskLimit defines the default medium priority task limit for resource manager. DefaultMediumTaskLimit = 1024 // DefaultLowTaskLimit defines the default low priority task limit for resource manager. DefaultLowTaskLimit = 16 )
const ( // NotUseTimeout defines the default task timeout. NotUseTimeout int64 = 0 // MinUploadTime defines the min timeout to upload object. MinUploadTime int64 = 2 // MaxUploadTime defines the max timeout to upload object. MaxUploadTime int64 = 300 // MinReplicateTime defines the min timeout to replicate object. MinReplicateTime int64 = 12 // MaxReplicateTime defines the max timeout to replicate object. MaxReplicateTime int64 = 500 // MinReceiveTime defines the min timeout to confirm the received piece whether is sealed on greenfield. MinReceiveTime int64 = 2 // MaxReceiveTime defines the max timeout to confirm the received piece whether is sealed on greenfield. MaxReceiveTime int64 = 10 // MinSealObjectTime defines the min timeout to seal object to greenfield. MinSealObjectTime int64 = 2 // MaxSealObjectTime defines the max timeout to seal object to greenfield. MaxSealObjectTime int64 = 5 // MinDownloadTime defines the min timeout to download object. MinDownloadTime int64 = 2 // MaxDownloadTime defines the max timeout to download object. MaxDownloadTime int64 = 300 // MinGcObjectTime defines the min timeout to gc object. MinGcObjectTime int64 = 300 // MaxGcObjectTime defines the max timeout to gc object. MaxGcObjectTime int64 = 600 // MinGcZombieTime defines the min timeout to gc zombie piece. MinGcZombieTime int64 = 300 // MaxGcZombieTime defines the max timeout to gc zombie piece. MaxGcZombieTime int64 = 600 // MinGCMetaTime defines the min timeout to gc meta. MinGCMetaTime int64 = 300 // MaxGCMetaTime defines the max timeout to gc meta. MaxGCMetaTime int64 = 600 // NotUseRetry defines the default task max retry. NotUseRetry int64 = 0 // MinReplicateRetry defines the min retry number to replicate object. MinReplicateRetry = 3 // MaxReplicateRetry defines the max retry number to replicate object. MaxReplicateRetry = 6 // MinReceiveConfirmRetry defines the min retry number to confirm received piece is sealed on greenfield. MinReceiveConfirmRetry = 2 // MaxReceiveConfirmRetry defines the max retry number to confirm received piece is sealed on greenfield. MaxReceiveConfirmRetry = 6 // MinSealObjectRetry defines the min retry number to seal object. MinSealObjectRetry = 3 // MaxSealObjectRetry defines the max retry number to seal object. MaxSealObjectRetry = 10 // MinGCObjectRetry defines the min retry number to gc object. MinGCObjectRetry = 3 // MaxGCObjectRetry defines the min retry number to gc object. MaxGCObjectRetry = 5 )
const (
BaseCodeSpace = "gfsp-base-app"
)
const (
// DefaultStopTime defines the default timeout for stopping services.
DefaultStopTime = 30
)
const (
// MaxServerCallMsgSize defines the max message size for grpc server
MaxServerCallMsgSize = 3 * 1024 * 1024 * 1024
)
Variables ¶
var ( ErrApprovalTaskDangling = gfsperrors.Register(BaseCodeSpace, http.StatusInternalServerError, 990101, "OoooH... request lost") ErrApprovalExhaustResource = gfsperrors.Register(BaseCodeSpace, http.StatusServiceUnavailable, 990102, "server overload, try again later") )
var ( ErrDownloadTaskDangling = gfsperrors.Register(BaseCodeSpace, http.StatusInternalServerError, 990301, "OoooH... request lost") ErrDownloadExhaustResource = gfsperrors.Register(BaseCodeSpace, http.StatusServiceUnavailable, 990302, "server overload, try again later") )
var ( ErrUploadTaskDangling = gfsperrors.Register(BaseCodeSpace, http.StatusInternalServerError, 990601, "OoooH... request lost") ErrUnsupportedTaskType = gfsperrors.Register(BaseCodeSpace, http.StatusNotFound, 990602, "unsupported task type") ErrNoTaskMatchLimit = gfsperrors.Register(BaseCodeSpace, http.StatusNotFound, 990603, "no task to dispatch below the require limits") )
var ( ErrReceiveTaskDangling = gfsperrors.Register(BaseCodeSpace, http.StatusInternalServerError, 990801, "OoooH... request lost") ErrReceiveExhaustResource = gfsperrors.Register(BaseCodeSpace, http.StatusServiceUnavailable, 990802, "server overload, try again later") )
var ( ErrUploadObjectDangling = gfsperrors.Register(BaseCodeSpace, http.StatusInternalServerError, 991101, "OoooH... request lost") ErrUploadExhaustResource = gfsperrors.Register(BaseCodeSpace, http.StatusServiceUnavailable, 991102, "server overload, try again later") ErrExceptionsStream = gfsperrors.Register(BaseCodeSpace, http.StatusBadRequest, 991103, "stream closed abnormally") )
var (
ErrFutureSupport = gfsperrors.Register(BaseCodeSpace, http.StatusNotFound, 995301, "future support")
)
var (
ErrReplicatePieceApprovalTaskDangling = gfsperrors.Register(BaseCodeSpace, http.StatusInternalServerError, 990701, "OoooH... request lost")
)
var (
ErrSingTaskDangling = gfsperrors.Register(BaseCodeSpace, http.StatusInternalServerError, 991001, "OoooH... request lost")
)
Functions ¶
func DefaultGfBsDB ¶
func DefaultGfBsDB(config *config.SQLDBConfig)
DefaultGfBsDB cast block syncer db connections, user and password if not loaded from env vars
func DefaultGfBsDBOption ¶
func DefaultGfBsDBOption(app *GfSpBaseApp, cfg *gfspconfig.GfSpConfig) error
func DefaultGfSpClientOption ¶
func DefaultGfSpClientOption(app *GfSpBaseApp, cfg *gfspconfig.GfSpConfig) error
func DefaultGfSpConsensusOption ¶
func DefaultGfSpConsensusOption(app *GfSpBaseApp, cfg *gfspconfig.GfSpConfig) error
func DefaultGfSpDBOption ¶
func DefaultGfSpDBOption(app *GfSpBaseApp, cfg *gfspconfig.GfSpConfig) error
func DefaultGfSpMetricOption ¶
func DefaultGfSpMetricOption(app *GfSpBaseApp, cfg *gfspconfig.GfSpConfig) error
func DefaultGfSpModulusOption ¶
func DefaultGfSpModulusOption(app *GfSpBaseApp, cfg *gfspconfig.GfSpConfig) error
func DefaultGfSpPieceOpOption ¶
func DefaultGfSpPieceOpOption(app *GfSpBaseApp, cfg *gfspconfig.GfSpConfig) error
func DefaultGfSpPieceStoreOption ¶
func DefaultGfSpPieceStoreOption(app *GfSpBaseApp, cfg *gfspconfig.GfSpConfig) error
func DefaultGfSpPprofOption ¶
func DefaultGfSpPprofOption(app *GfSpBaseApp, cfg *gfspconfig.GfSpConfig) error
func DefaultGfSpResourceManagerOption ¶
func DefaultGfSpResourceManagerOption(app *GfSpBaseApp, cfg *gfspconfig.GfSpConfig) error
func DefaultGfSpTQueueOption ¶
func DefaultGfSpTQueueOption(app *GfSpBaseApp, cfg *gfspconfig.GfSpConfig) error
func DefaultGrpcServerOptions ¶
func DefaultGrpcServerOptions() []grpc.ServerOption
func DefaultStaticOption ¶
func DefaultStaticOption(app *GfSpBaseApp, cfg *gfspconfig.GfSpConfig) error
func GetRegisterModulus ¶
func GetRegisterModulus() []string
GetRegisterModulus returns the list registered modules.
func GetRegisterModulusDescription ¶
func GetRegisterModulusDescription() string
GetRegisterModulusDescription returns the list registered modules' description.
func RegisterModular ¶
func RegisterModular(name string, description string, newFunc NewModularFunc)
RegisterModular registers the module info to the global ModularManager
func RpcRemoteAddress ¶
Types ¶
type GfSpBaseApp ¶
type GfSpBaseApp struct {
// contains filtered or unexported fields
}
func NewGfSpBaseApp ¶
func NewGfSpBaseApp(cfg *gfspconfig.GfSpConfig, opts ...gfspconfig.Option) (*GfSpBaseApp, error)
func (*GfSpBaseApp) AppID ¶
func (g *GfSpBaseApp) AppID() string
AppID returns the GfSpBaseApp ID, the default value is prefix(gfsp) add started modules' name.
func (*GfSpBaseApp) Consensus ¶
func (g *GfSpBaseApp) Consensus() consensus.Consensus
Consensus returns greenfield consensus query client.
func (*GfSpBaseApp) EnableMetrics ¶
func (g *GfSpBaseApp) EnableMetrics() bool
EnableMetrics returns an indicator whether enable the metrics service.
func (*GfSpBaseApp) GetAuthNonce ¶
func (g *GfSpBaseApp) GetAuthNonce(ctx context.Context, req *gfspserver.GetAuthNonceRequest) (*gfspserver.GetAuthNonceResponse, error)
GetAuthNonce get the auth nonce for which the Dapp or client can generate EDDSA key pairs.
func (*GfSpBaseApp) GfBsDB ¶
func (g *GfSpBaseApp) GfBsDB() bsdb.BSDB
GfBsDB returns the block syncer db client.
func (*GfSpBaseApp) GfBsDBBackup ¶
func (g *GfSpBaseApp) GfBsDBBackup() bsdb.BSDB
GfBsDBBackup returns the backup block syncer db client.
func (*GfSpBaseApp) GfBsDBMaster ¶
func (g *GfSpBaseApp) GfBsDBMaster() bsdb.BSDB
GfBsDBMaster returns the master block syncer db client.
func (*GfSpBaseApp) GfSpAskApproval ¶
func (g *GfSpBaseApp) GfSpAskApproval( ctx context.Context, req *gfspserver.GfSpAskApprovalRequest) ( *gfspserver.GfSpAskApprovalResponse, error)
func (*GfSpBaseApp) GfSpAskSecondaryReplicatePieceApproval ¶
func (g *GfSpBaseApp) GfSpAskSecondaryReplicatePieceApproval( ctx context.Context, req *gfspserver.GfSpAskSecondaryReplicatePieceApprovalRequest) ( *gfspserver.GfSpAskSecondaryReplicatePieceApprovalResponse, error)
func (*GfSpBaseApp) GfSpAskTask ¶
func (g *GfSpBaseApp) GfSpAskTask( ctx context.Context, req *gfspserver.GfSpAskTaskRequest) ( *gfspserver.GfSpAskTaskResponse, error)
func (*GfSpBaseApp) GfSpBeginTask ¶
func (g *GfSpBaseApp) GfSpBeginTask( ctx context.Context, req *gfspserver.GfSpBeginTaskRequest) ( *gfspserver.GfSpBeginTaskResponse, error)
func (*GfSpBaseApp) GfSpClient ¶
func (g *GfSpBaseApp) GfSpClient() *gfspclient.GfSpClient
GfSpClient returns the sp client that includes inner grpc and outer http protocol.
func (*GfSpBaseApp) GfSpDB ¶
func (g *GfSpBaseApp) GfSpDB() spdb.SPDB
GfSpDB returns the sp db client.
func (*GfSpBaseApp) GfSpDoneReplicatePiece ¶
func (g *GfSpBaseApp) GfSpDoneReplicatePiece( ctx context.Context, req *gfspserver.GfSpDoneReplicatePieceRequest) ( *gfspserver.GfSpDoneReplicatePieceResponse, error)
func (*GfSpBaseApp) GfSpDownloadObject ¶
func (g *GfSpBaseApp) GfSpDownloadObject( ctx context.Context, req *gfspserver.GfSpDownloadObjectRequest) ( *gfspserver.GfSpDownloadObjectResponse, error)
func (*GfSpBaseApp) GfSpGetChallengeInfo ¶
func (g *GfSpBaseApp) GfSpGetChallengeInfo( ctx context.Context, req *gfspserver.GfSpGetChallengeInfoRequest) ( *gfspserver.GfSpGetChallengeInfoResponse, error)
func (*GfSpBaseApp) GfSpQueryP2PBootstrap ¶
func (g *GfSpBaseApp) GfSpQueryP2PBootstrap(ctx context.Context, req *gfspserver.GfSpQueryP2PNodeRequest) ( *gfspserver.GfSpQueryP2PNodeResponse, error)
func (*GfSpBaseApp) GfSpQueryResourceLimit ¶
func (g *GfSpBaseApp) GfSpQueryResourceLimit( context.Context, *gfspserver.GfSpQueryResourceLimitRequest) ( *gfspserver.GfSpQueryResourceLimitResponse, error)
func (*GfSpBaseApp) GfSpQueryTasks ¶
func (g *GfSpBaseApp) GfSpQueryTasks( ctx context.Context, req *gfspserver.GfSpQueryTasksRequest) ( *gfspserver.GfSpQueryTasksResponse, error)
func (*GfSpBaseApp) GfSpReplicatePiece ¶
func (g *GfSpBaseApp) GfSpReplicatePiece( ctx context.Context, req *gfspserver.GfSpReplicatePieceRequest) ( *gfspserver.GfSpReplicatePieceResponse, error)
func (*GfSpBaseApp) GfSpReportTask ¶
func (g *GfSpBaseApp) GfSpReportTask( ctx context.Context, req *gfspserver.GfSpReportTaskRequest) ( *gfspserver.GfSpReportTaskResponse, error)
func (*GfSpBaseApp) GfSpSetResourceLimit ¶
func (g *GfSpBaseApp) GfSpSetResourceLimit( context.Context, *gfspserver.GfSpSetResourceLimitRequest) ( *gfspserver.GfSpSetResourceLimitResponse, error)
func (*GfSpBaseApp) GfSpSign ¶
func (g *GfSpBaseApp) GfSpSign( ctx context.Context, req *gfspserver.GfSpSignRequest) ( *gfspserver.GfSpSignResponse, error)
func (*GfSpBaseApp) GfSpUploadObject ¶
func (g *GfSpBaseApp) GfSpUploadObject(stream gfspserver.GfSpUploadService_GfSpUploadObjectServer) error
func (*GfSpBaseApp) GfSpVerifyAuthorize ¶
func (g *GfSpBaseApp) GfSpVerifyAuthorize( ctx context.Context, req *gfspserver.GfSpAuthorizeRequest) ( *gfspserver.GfSpAuthorizeResponse, error)
func (*GfSpBaseApp) OnAskCreateBucketApproval ¶
func (g *GfSpBaseApp) OnAskCreateBucketApproval( ctx context.Context, task task.ApprovalCreateBucketTask) ( bool, error)
func (*GfSpBaseApp) OnAskCreateObjectApproval ¶
func (g *GfSpBaseApp) OnAskCreateObjectApproval( ctx context.Context, task task.ApprovalCreateObjectTask) ( bool, error)
func (*GfSpBaseApp) OnBeginUploadObjectTask ¶
func (g *GfSpBaseApp) OnBeginUploadObjectTask( ctx context.Context, task coretask.UploadObjectTask) error
func (*GfSpBaseApp) OnChallengePieceTask ¶
func (g *GfSpBaseApp) OnChallengePieceTask( ctx context.Context, task task.ChallengePieceTask) ( []byte, [][]byte, []byte, error)
func (*GfSpBaseApp) OnDownloadObjectTask ¶
func (g *GfSpBaseApp) OnDownloadObjectTask( ctx context.Context, task task.DownloadObjectTask) ( []byte, error)
func (*GfSpBaseApp) OperateAddress ¶
func (g *GfSpBaseApp) OperateAddress() string
OperateAddress returns the sp operator address.
func (*GfSpBaseApp) PieceOp ¶
func (g *GfSpBaseApp) PieceOp() piecestore.PieceOp
PieceOp returns piece helper struct instance.
func (*GfSpBaseApp) PieceStore ¶
func (g *GfSpBaseApp) PieceStore() piecestore.PieceStore
PieceStore returns the piece store client.
func (*GfSpBaseApp) RegisterServices ¶
func (g *GfSpBaseApp) RegisterServices(services ...corelifecycle.Service)
RegisterServices register services of an application.
func (*GfSpBaseApp) ResourceManager ¶
func (g *GfSpBaseApp) ResourceManager() corercmgr.ResourceManager
ResourceManager returns the resource manager for module to open own resource span.
func (*GfSpBaseApp) ServerForRegister ¶
func (g *GfSpBaseApp) ServerForRegister() *grpc.Server
ServerForRegister returns the Grpc server for module register own service.
func (*GfSpBaseApp) SetGfBsDB ¶
func (g *GfSpBaseApp) SetGfBsDB(setDB bsdb.BSDB) bsdb.BSDB
SetGfBsDB sets the block syncer db client.
func (*GfSpBaseApp) Signals ¶
func (g *GfSpBaseApp) Signals(sigs ...os.Signal) corelifecycle.Lifecycle
Signals registers monitor signals.
func (*GfSpBaseApp) Start ¶
func (g *GfSpBaseApp) Start(ctx context.Context) error
Start the GfSpBaseApp and blocks the progress until signal.
func (*GfSpBaseApp) StartRpcServer ¶
func (g *GfSpBaseApp) StartRpcServer(ctx context.Context) error
func (*GfSpBaseApp) StartServices ¶
func (g *GfSpBaseApp) StartServices(ctx context.Context) corelifecycle.Lifecycle
StartServices starts running services.
func (*GfSpBaseApp) StopRpcServer ¶
func (g *GfSpBaseApp) StopRpcServer(ctx context.Context) error
func (*GfSpBaseApp) StopServices ¶
func (g *GfSpBaseApp) StopServices(ctx context.Context)
StopServices stop services when context is done or timeout.
func (*GfSpBaseApp) TaskMaxRetry ¶
func (g *GfSpBaseApp) TaskMaxRetry(task coretask.Task) int64
TaskMaxRetry returns the task max retry by task type.
func (*GfSpBaseApp) TaskPriority ¶
func (g *GfSpBaseApp) TaskPriority(task coretask.Task) coretask.TPriority
TaskPriority returns the task priority by task type, it is the default options. the task priority support self define and dynamic settings.
func (*GfSpBaseApp) TaskPriorityLevel ¶
func (g *GfSpBaseApp) TaskPriorityLevel(task coretask.Task) coretask.TPriorityLevel
TaskPriorityLevel returns the task priority level, it is computed by task priority.
func (*GfSpBaseApp) TaskTimeout ¶
func (g *GfSpBaseApp) TaskTimeout(task coretask.Task, size uint64) int64
TaskTimeout returns the task timeout by task type and some task need payload size to compute, example: upload, download, etc.
func (*GfSpBaseApp) UpdateUserPublicKey ¶
func (g *GfSpBaseApp) UpdateUserPublicKey(ctx context.Context, req *gfspserver.UpdateUserPublicKeyRequest) (*gfspserver.UpdateUserPublicKeyResponse, error)
UpdateUserPublicKey updates the user public key once the Dapp or client generates the EDDSA key pairs.
func (*GfSpBaseApp) VerifyOffChainSignature ¶
func (g *GfSpBaseApp) VerifyOffChainSignature(ctx context.Context, req *gfspserver.VerifyOffChainSignatureRequest) (*gfspserver.VerifyOffChainSignatureResponse, error)
VerifyOffChainSignature verifies the signature signed by user's EDDSA private key.
func (*GfSpBaseApp) Wait ¶
func (g *GfSpBaseApp) Wait(ctx context.Context)
Wait blocks until context is done.
type ModularManager ¶
type ModularManager struct {
// contains filtered or unexported fields
}
ModularManager manages the modules, record the module info, module info include: module name, module description and new module func. Module name is an indexer for starting, the start module name comes from config file or '--service' command flag. Module description uses for 'list' command that shows the SP supports modules info. New module func is help module manager to init the module instance.
type NewModularFunc ¶
type NewModularFunc = func(app *GfSpBaseApp, cfg *gfspconfig.GfSpConfig) (coremodule.Modular, error)
NewModularFunc defines the module new instance func type.
func GetNewModularFunc ¶
func GetNewModularFunc(name string) NewModularFunc
GetNewModularFunc returns the list registered module's new instances func.
type Option ¶
type Option func(app *GfSpBaseApp, cfg *gfspconfig.GfSpConfig) error
Option defines the GfSpBaseApp and module init options func type.