Documentation ¶
Index ¶
- Constants
- Variables
- type Gnfd
- func (g *Gnfd) Close() error
- func (g *Gnfd) CurrentHeight(ctx context.Context) (height uint64, err error)
- func (g *Gnfd) HasAccount(ctx context.Context, address string) (has bool, err error)
- func (g *Gnfd) ListBondedValidators(ctx context.Context) (validators []stakingtypes.Validator, err error)
- func (g *Gnfd) ListSPs(ctx context.Context) (spInfos []*sptypes.StorageProvider, err error)
- func (g *Gnfd) ListenObjectSeal(ctx context.Context, objectID uint64, timeoutHeight int) (seal bool, err error)
- func (g *Gnfd) ListenRejectUnSealObject(ctx context.Context, objectID uint64, timeoutHeight int) (rejected bool, err error)
- func (g *Gnfd) QueryBucketInfo(ctx context.Context, bucket string) (bucketInfo *storagetypes.BucketInfo, err error)
- func (g *Gnfd) QueryBucketInfoAndObjectInfo(ctx context.Context, bucket, object string) (bucketInfo *storagetypes.BucketInfo, objectInfo *storagetypes.ObjectInfo, ...)
- func (g *Gnfd) QueryObjectInfo(ctx context.Context, bucket, object string) (objectInfo *storagetypes.ObjectInfo, err error)
- func (g *Gnfd) QueryObjectInfoByID(ctx context.Context, objectID string) (objectInfo *storagetypes.ObjectInfo, err error)
- func (g *Gnfd) QueryPaymentStreamRecord(ctx context.Context, account string) (stream *paymenttypes.StreamRecord, err error)
- func (g *Gnfd) QueryStorageParams(ctx context.Context) (params *storagetypes.Params, err error)
- func (g *Gnfd) QueryStorageParamsByTimestamp(ctx context.Context, timestamp int64) (params *storagetypes.Params, err error)
- func (g *Gnfd) VerifyGetObjectPermission(ctx context.Context, account, bucket, object string) (allow bool, err error)
- func (g *Gnfd) VerifyPutObjectPermission(ctx context.Context, account, bucket, object string) (allow bool, err error)
- type GnfdChainConfig
- type GreenfieldClient
Constants ¶
const ( GreenFieldChain = "GreenfieldChain" // UpdateClientInternal defines the period of updating the best chain client UpdateClientInternal = 60 // ExpectedOutputBlockInternal defines the time of estimating output block time ExpectedOutputBlockInternal = 2 )
const ( // ChainSuccessTotal defines the metrics label of successfully total chain rpc ChainSuccessTotal = "chain_total_success" // ChainFailureTotal defines the metrics label of unsuccessfully total chain rpc ChainFailureTotal = "chain_total_failure" // ChainSuccessCurrentHeight defines the metrics label of successfully get current block height ChainSuccessCurrentHeight = "get_current_height_success" // ChainFailureCurrentHeight defines the metrics label of unsuccessfully get current block height ChainFailureCurrentHeight = "get_current_height_failure" // ChainSuccessHasAccount defines the metrics label of successfully check has account ChainSuccessHasAccount = "has_account_success" // ChainFailureHasAccount defines the metrics label of unsuccessfully check has account ChainFailureHasAccount = "has_account_failure" // ChainSuccessListSPs defines the metrics label of successfully list all sp infos ChainSuccessListSPs = "list_sp_success" // ChainFailureListSPs defines the metrics label of unsuccessfully list all sp infos ChainFailureListSPs = "list_sp_failure" // ChainSuccessListBondedValidators defines the metrics label of successfully list bonded validators ChainSuccessListBondedValidators = "list_bonded_validators_success" // ChainFailureListBondedValidators defines the metrics label of unsuccessfully list bonded validators ChainFailureListBondedValidators = "list_bonded_validators_failure" // ChainSuccessQueryStorageParams defines the metrics label of successfully query storage params ChainSuccessQueryStorageParams = "query_storage_param_success" // ChainFailureQueryStorageParams defines the metrics label of unsuccessfully query storage params ChainFailureQueryStorageParams = "query_storage_param_failure" // ChainSuccessQueryStorageParamsByTimestamp defines the metrics label of successfully query storage params by time ChainSuccessQueryStorageParamsByTimestamp = "query_storage_param_by_timestamp_success" // ChainFailureQueryStorageParamsByTimestamp defines the metrics label of unsuccessfully query storage params by time ChainFailureQueryStorageParamsByTimestamp = "query_storage_param_by_timestamp_failure" // ChainSuccessQueryBucketInfo defines the metrics label of successfully query bucket info ChainSuccessQueryBucketInfo = "query_bucket_info_success" // ChainFailureQueryBucketInfo defines the metrics label of successfully query object info ChainFailureQueryBucketInfo = "query_bucket_info_failure" // ChainSuccessQueryObjectInfo defines the metrics label of successfully query object info ChainSuccessQueryObjectInfo = "query_object_info_success" // ChainFailureQueryObjectInfo defines the metrics label of unsuccessfully query object info ChainFailureQueryObjectInfo = "query_object_info_failure" // ChainSuccessQueryObjectInfoByID defines the metrics label of successfully query object info by id ChainSuccessQueryObjectInfoByID = "query_object_info_by_id_success" // ChainFailureQueryObjectInfoByID defines the metrics label of unsuccessfully query object info by id ChainFailureQueryObjectInfoByID = "query_object_info_by_id_failure" // ChainSuccessQueryBucketInfoAndObjectInfo defines the metrics label of successfully query bucket and object info ChainSuccessQueryBucketInfoAndObjectInfo = "query_bucket_and_object_info_success" // ChainFailureQueryBucketInfoAndObjectInfo defines the metrics label of unsuccessfully query bucket and object info ChainFailureQueryBucketInfoAndObjectInfo = "query_bucket_and_object_info_failure" // ChainSuccessListenObjectSeal defines the metrics label of successfully listen object seal ChainSuccessListenObjectSeal = "listen_object_seal_success" // ChainFailureListenObjectSeal defines the metrics label of unsuccessfully listen object seal ChainFailureListenObjectSeal = "listen_object_seal_failure" // ChainSuccessListenRejectUnSealObject defines the metrics label of successfully listen object reject unseal ChainSuccessListenRejectUnSealObject = "listen_reject_unseal_object_success" // ChainFailureListenRejectUnSealObject defines the metrics label of unsuccessfully listen object reject unseal ChainFailureListenRejectUnSealObject = "listen_reject_unseal_object_failure" // ChainSuccessQueryPaymentStreamRecord defines the metrics label of successfully query payment stream ChainSuccessQueryPaymentStreamRecord = "query_payment_stream_record_success" // ChainFailureQueryPaymentStreamRecord defines the metrics label of unsuccessfully query payment stream ChainFailureQueryPaymentStreamRecord = "query_payment_stream_record_failure" // ChainSuccessVerifyGetObjectPermission defines the metrics label of successfully verify get object permission ChainSuccessVerifyGetObjectPermission = "verify_get_object_permission_success" // ChainFailureVerifyGetObjectPermission defines the metrics label of unsuccessfully verify get object permission ChainFailureVerifyGetObjectPermission = "verify_get_object_permission_failure" // ChainSuccessVerifyPutObjectPermission defines the metrics label of successfully verify put object permission ChainSuccessVerifyPutObjectPermission = "verify_putt_object_permission_success" // ChainFailureVerifyPutObjectPermission defines the metrics label of unsuccessfully verify put object permission ChainFailureVerifyPutObjectPermission = "verify_put_object_permission_failure" )
Variables ¶
var ( ErrNoSuchBucket = gfsperrors.Register(GreenFieldChain, http.StatusBadRequest, 500001, "no such bucket") ErrSealTimeout = gfsperrors.Register(GreenFieldChain, http.StatusBadRequest, 500002, "seal failed") ErrRejectUnSealTimeout = gfsperrors.Register(GreenFieldChain, http.StatusBadRequest, 500003, "reject unseal failed") )
Functions ¶
This section is empty.
Types ¶
type Gnfd ¶
type Gnfd struct {
// contains filtered or unexported fields
}
func NewGnfd ¶
func NewGnfd(cfg *GnfdChainConfig) (*Gnfd, error)
NewGnfd returns the Greenfield instance.
func (*Gnfd) CurrentHeight ¶
CurrentHeight the block height sub one as the stable height.
func (*Gnfd) HasAccount ¶
HasAccount returns an indication of the existence of address.
func (*Gnfd) ListBondedValidators ¶
func (g *Gnfd) ListBondedValidators(ctx context.Context) (validators []stakingtypes.Validator, err error)
ListBondedValidators returns the list of bonded validators.
func (*Gnfd) ListenObjectSeal ¶
func (g *Gnfd) ListenObjectSeal(ctx context.Context, objectID uint64, timeoutHeight int) (seal bool, err error)
ListenObjectSeal returns an indication of the object is sealed. TODO:: retrieve service support seal event subscription
func (*Gnfd) ListenRejectUnSealObject ¶
func (g *Gnfd) ListenRejectUnSealObject(ctx context.Context, objectID uint64, timeoutHeight int) (rejected bool, err error)
ListenRejectUnSealObject returns an indication of the object is rejected. TODO:: retrieve service support reject unseal event subscription
func (*Gnfd) QueryBucketInfo ¶
func (g *Gnfd) QueryBucketInfo(ctx context.Context, bucket string) (bucketInfo *storagetypes.BucketInfo, err error)
QueryBucketInfo returns the bucket info by name.
func (*Gnfd) QueryBucketInfoAndObjectInfo ¶
func (g *Gnfd) QueryBucketInfoAndObjectInfo(ctx context.Context, bucket, object string) (bucketInfo *storagetypes.BucketInfo, objectInfo *storagetypes.ObjectInfo, err error)
QueryBucketInfoAndObjectInfo returns bucket info and object info, if not found, return the corresponding error code
func (*Gnfd) QueryObjectInfo ¶
func (g *Gnfd) QueryObjectInfo(ctx context.Context, bucket, object string) (objectInfo *storagetypes.ObjectInfo, err error)
QueryObjectInfo returns the object info by name.
func (*Gnfd) QueryObjectInfoByID ¶
func (g *Gnfd) QueryObjectInfoByID(ctx context.Context, objectID string) (objectInfo *storagetypes.ObjectInfo, err error)
QueryObjectInfoByID returns the object info by name.
func (*Gnfd) QueryPaymentStreamRecord ¶
func (g *Gnfd) QueryPaymentStreamRecord(ctx context.Context, account string) (stream *paymenttypes.StreamRecord, err error)
QueryPaymentStreamRecord returns the steam record info by account.
func (*Gnfd) QueryStorageParams ¶
QueryStorageParams returns storage params
func (*Gnfd) QueryStorageParamsByTimestamp ¶
func (g *Gnfd) QueryStorageParamsByTimestamp(ctx context.Context, timestamp int64) (params *storagetypes.Params, err error)
QueryStorageParamsByTimestamp returns storage params by block create time.
type GnfdChainConfig ¶
type GreenfieldClient ¶
type GreenfieldClient struct { Provider string // contains filtered or unexported fields }
GreenfieldClient the greenfield chain client, only use to query.
func (*GreenfieldClient) GnfdClient ¶
func (client *GreenfieldClient) GnfdClient() *chainClient.GreenfieldClient
GnfdClient returns the greenfield chain client.