gnfd

package
v0.2.1-alpha.4 Latest Latest
Warning

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

Go to latest
Published: May 31, 2023 License: GPL-3.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

View Source
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
)

Variables

View Source
var (
	ErrNoSuchBucket = gfsperrors.Register(GreenFieldChain, http.StatusInternalServerError, 500001, "no such bucket")
	ErrSealTimeout  = gfsperrors.Register(GreenFieldChain, http.StatusInternalServerError, 500002, "seal 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) Close

func (g *Gnfd) Close() error

Close the Greenfield instance.

func (*Gnfd) CurrentHeight

func (g *Gnfd) CurrentHeight(
	ctx context.Context) (uint64, error)

CurrentHeight the block height sub one as the stable height.

func (*Gnfd) HasAccount

func (g *Gnfd) HasAccount(
	ctx context.Context,
	address string) (bool, error)

HasAccount returns an indication of the existence of address.

func (*Gnfd) ListenObjectSeal

func (g *Gnfd) ListenObjectSeal(
	ctx context.Context,
	objectID uint64,
	timeoutHeight int) (bool, error)

ListenObjectSeal returns an indication of the object is sealed. TODO:: retrieve service support seal event subscription

func (*Gnfd) QueryBucketInfo

func (g *Gnfd) QueryBucketInfo(
	ctx context.Context,
	bucket string) (
	*storagetypes.BucketInfo, error)

QueryBucketInfo returns the bucket info by name.

func (*Gnfd) QueryBucketInfoAndObjectInfo

func (g *Gnfd) QueryBucketInfoAndObjectInfo(
	ctx context.Context,
	bucket, object string) (
	*storagetypes.BucketInfo,
	*storagetypes.ObjectInfo,
	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) (
	*storagetypes.ObjectInfo, error)

QueryObjectInfo returns the object info by name.

func (*Gnfd) QueryObjectInfoByID

func (g *Gnfd) QueryObjectInfoByID(
	ctx context.Context,
	objectID string) (
	*storagetypes.ObjectInfo, error)

QueryObjectInfoByID returns the object info by name.

func (*Gnfd) QueryPaymentStreamRecord

func (g *Gnfd) QueryPaymentStreamRecord(
	ctx context.Context,
	account string) (
	*paymenttypes.StreamRecord,
	error)

QueryPaymentStreamRecord returns the steam record info by account.

func (*Gnfd) QuerySPInfo

func (g *Gnfd) QuerySPInfo(
	ctx context.Context) (
	[]*sptypes.StorageProvider, error)

QuerySPInfo returns the list of storage provider info.

func (*Gnfd) QueryStorageParams

func (g *Gnfd) QueryStorageParams(
	ctx context.Context) (
	params *storagetypes.Params, err error)

QueryStorageParams returns storage params

func (*Gnfd) VerifyGetObjectPermission

func (g *Gnfd) VerifyGetObjectPermission(
	ctx context.Context,
	account, bucket, object string) (
	bool, error)

VerifyGetObjectPermission verifies get object permission.

func (*Gnfd) VerifyPutObjectPermission

func (g *Gnfd) VerifyPutObjectPermission(
	ctx context.Context,
	account, bucket, object string) (
	bool, error)

VerifyPutObjectPermission verifies put object permission.

type GnfdChainConfig

type GnfdChainConfig struct {
	ChainID      string
	ChainAddress []string
}

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.

Jump to

Keyboard shortcuts

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