gfspclient

package
v0.2.1-test-4 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const (
	// MaxCallMsgSize defines the max message size for grpc client
	MaxCallMsgSize = 3 * 1024 * 1024 * 1024
	// ClientCodeSpace defines the code space for gfsp client
	ClientCodeSpace = "GfSpClient"
	// HttpMaxIdleConns defines the max idle connections for HTTP server
	HttpMaxIdleConns = 20
	// HttpIdleConnTimout defines the idle time of connection for closing
	HttpIdleConnTimout = 60 * time.Second
)

Variables

View Source
var (
	ErrRpcUnknown       = gfsperrors.Register(ClientCodeSpace, http.StatusNotFound, 98001, "server slipped away, try again later")
	ErrExceptionsStream = gfsperrors.Register(ClientCodeSpace, http.StatusBadRequest, 98002, "stream closed abnormally")
	ErrTypeMismatch     = gfsperrors.Register(ClientCodeSpace, http.StatusInternalServerError, 98101, "response type mismatch")
)

Functions

func DefaultClientOptions

func DefaultClientOptions() []grpc.DialOption

Types

type GfSpClient

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

func NewGfSpClient

func NewGfSpClient(
	approverEndpoint string,
	managerEndpoint string,
	downloaderEndpoint string,
	receiverEndpoint string,
	metadataEndpoint string,
	uploaderEndpoint string,
	p2pEndpoint string,
	signerEndpoint string,
	authorizerEndpoint string,
	metrics bool) *GfSpClient

func (*GfSpClient) ApproverConn

func (s *GfSpClient) ApproverConn(
	ctx context.Context,
	opts ...grpc.DialOption) (
	*grpc.ClientConn, error)

func (*GfSpClient) AskCreateBucketApproval

func (*GfSpClient) AskCreateObjectApproval

func (*GfSpClient) AskSecondaryReplicatePieceApproval

func (s *GfSpClient) AskSecondaryReplicatePieceApproval(
	ctx context.Context,
	task coretask.ApprovalReplicatePieceTask,
	low, high int,
	timeout int64) (
	[]*gfsptask.GfSpReplicatePieceApprovalTask, error)

func (*GfSpClient) AskTask

func (s *GfSpClient) AskTask(
	ctx context.Context,
	limit corercmgr.Limit) (
	coretask.Task, error)

func (*GfSpClient) Close

func (s *GfSpClient) Close() error

func (*GfSpClient) Connection

func (s *GfSpClient) Connection(
	ctx context.Context,
	address string,
	opts ...grpc.DialOption) (
	*grpc.ClientConn, error)

func (*GfSpClient) CreateUploadObject

func (s *GfSpClient) CreateUploadObject(
	ctx context.Context,
	task coretask.UploadObjectTask) error

func (*GfSpClient) DoneReplicatePiece

func (s *GfSpClient) DoneReplicatePiece(
	ctx context.Context,
	task coretask.ReceivePieceTask,
	opts ...grpc.DialOption) (
	[]byte, []byte, error)

func (*GfSpClient) DoneReplicatePieceToSecondary

func (s *GfSpClient) DoneReplicatePieceToSecondary(
	ctx context.Context,
	endpoint string,
	approval coretask.ApprovalReplicatePieceTask,
	receive coretask.ReceivePieceTask,
) ([]byte, []byte, error)

func (*GfSpClient) GetBucketByBucketID

func (s *GfSpClient) GetBucketByBucketID(ctx context.Context,
	bucketId int64,
	isFullList bool,
	opts ...grpc.DialOption) (*types.GfSpGetBucketByBucketIDResponse, error)

GetBucketByBucketID get bucket info by a bucket id

func (*GfSpClient) GetBucketByBucketName

func (s *GfSpClient) GetBucketByBucketName(
	ctx context.Context,
	bucketName string,
	isFullList bool,
	opts ...grpc.DialOption) (*types.Bucket, error)

GetBucketByBucketName get bucket info by a bucket name

func (*GfSpClient) GetBucketMeta

func (s *GfSpClient) GetBucketMeta(
	ctx context.Context,
	bucketName string,
	isFullList bool,
	opts ...grpc.DialOption) (*types.Bucket, *payment_types.StreamRecord, error)

GetBucketMeta get bucket info along with its related info such as payment

func (*GfSpClient) GetBucketReadQuota

func (s *GfSpClient) GetBucketReadQuota(
	ctx context.Context,
	bucket *storage_types.BucketInfo,
	yearMonth string,
	opts ...grpc.DialOption) (
	uint64, uint64, uint64, error)

func (*GfSpClient) GetChallengeInfo

func (s *GfSpClient) GetChallengeInfo(
	ctx context.Context,
	task coretask.ChallengePieceTask,
	opts ...grpc.DialOption) (
	[]byte, [][]byte, []byte, error)

func (*GfSpClient) GetEndpointBySpAddress

func (s *GfSpClient) GetEndpointBySpAddress(
	ctx context.Context,
	spAddress string,
	opts ...grpc.DialOption) (
	string, error)

GetEndpointBySpAddress get endpoint by sp address

func (*GfSpClient) GetObject

func (s *GfSpClient) GetObject(
	ctx context.Context,
	task coretask.DownloadObjectTask,
	opts ...grpc.DialOption) (
	[]byte, error)

func (*GfSpClient) GetObjectMeta

func (s *GfSpClient) GetObjectMeta(
	ctx context.Context,
	objectName string,
	bucketName string,
	isFullList bool,
	opts ...grpc.DialOption) (*types.Object, error)

GetObjectMeta get object metadata

func (*GfSpClient) GetPaymentByBucketID

func (s *GfSpClient) GetPaymentByBucketID(
	ctx context.Context,
	bucketID int64,
	isFullList bool,
	opts ...grpc.DialOption) (*payment_types.StreamRecord, error)

GetPaymentByBucketID get bucket payment info by a bucket id

func (*GfSpClient) GetPaymentByBucketName

func (s *GfSpClient) GetPaymentByBucketName(
	ctx context.Context,
	bucketName string,
	isFullList bool,
	opts ...grpc.DialOption) (*payment_types.StreamRecord, error)

GetPaymentByBucketName get bucket payment info by a bucket name

func (*GfSpClient) GetUploadObjectState

func (s *GfSpClient) GetUploadObjectState(
	ctx context.Context,
	objectID uint64,
	opts ...grpc.DialOption) (int32, error)

func (*GfSpClient) GetUserBuckets

func (s *GfSpClient) GetUserBuckets(
	ctx context.Context,
	account string,
	opts ...grpc.DialOption) ([]*types.Bucket, error)

func (*GfSpClient) GetUserBucketsCount

func (s *GfSpClient) GetUserBucketsCount(
	ctx context.Context,
	account string,
	opts ...grpc.DialOption) (int64, error)

func (*GfSpClient) HttpClient

func (s *GfSpClient) HttpClient(ctx context.Context) *http.Client

func (*GfSpClient) ListBucketReadRecord

func (s *GfSpClient) ListBucketReadRecord(
	ctx context.Context,
	bucket *storage_types.BucketInfo,
	startTimestampUs, endTimestampUs, maxRecordNum int64,
	opts ...grpc.DialOption) (
	[]*types.ReadRecord, int64, error)

func (*GfSpClient) ListDeletedObjectsByBlockNumberRange

func (s *GfSpClient) ListDeletedObjectsByBlockNumberRange(
	ctx context.Context,
	spOperatorAddress string,
	startBlockNumber uint64,
	endBlockNumber uint64,
	includePrivate bool,
	opts ...grpc.DialOption) ([]*types.Object, uint64, error)

func (*GfSpClient) ListExpiredBucketsBySp

func (s *GfSpClient) ListExpiredBucketsBySp(ctx context.Context, createAt int64, primarySpAddress string, limit int64, opts ...grpc.DialOption) ([]*types.Bucket, error)

ListExpiredBucketsBySp list buckets that are expired by specific sp

func (*GfSpClient) ListObjectsByBucketName

func (s *GfSpClient) ListObjectsByBucketName(
	ctx context.Context,
	bucketName string,
	accountId string,
	maxKeys uint64,
	startAfter string,
	continuationToken string,
	delimiter string,
	prefix string,
	opts ...grpc.DialOption) (
	objects []*types.Object,
	KeyCount uint64,
	MaxKeys uint64,
	IsTruncated bool,
	NextContinuationToken string,
	Name string,
	Prefix string,
	Delimiter string,
	CommonPrefixes []string,
	ContinuationToken string,
	err error)

ListObjectsByBucketName list objects info by a bucket name

func (*GfSpClient) ManagerConn

func (s *GfSpClient) ManagerConn(
	ctx context.Context,
	opts ...grpc.DialOption) (
	*grpc.ClientConn, error)

func (*GfSpClient) P2PConn

func (s *GfSpClient) P2PConn(
	ctx context.Context,
	opts ...grpc.DialOption) (
	*grpc.ClientConn, error)

func (*GfSpClient) QueryP2PBootstrap

func (s *GfSpClient) QueryP2PBootstrap(ctx context.Context) ([]string, error)

func (*GfSpClient) QueryTasks

func (s *GfSpClient) QueryTasks(
	ctx context.Context,
	endpoint string,
	subKey string) (
	[]string, error)

func (*GfSpClient) ReplicatePiece

func (s *GfSpClient) ReplicatePiece(
	ctx context.Context,
	task coretask.ReceivePieceTask,
	data []byte,
	opts ...grpc.DialOption) error

func (*GfSpClient) ReplicatePieceToSecondary

func (s *GfSpClient) ReplicatePieceToSecondary(
	ctx context.Context,
	endpoint string,
	approval coretask.ApprovalReplicatePieceTask,
	receive coretask.ReceivePieceTask,
	data []byte) error

func (*GfSpClient) ReportTask

func (s *GfSpClient) ReportTask(
	ctx context.Context,
	report coretask.Task) error

func (*GfSpClient) SealObject

func (s *GfSpClient) SealObject(
	ctx context.Context,
	object *storagetypes.MsgSealObject) error

func (*GfSpClient) SignCreateBucketApproval

func (s *GfSpClient) SignCreateBucketApproval(
	ctx context.Context,
	bucket *storagetypes.MsgCreateBucket) (
	[]byte, error)

func (*GfSpClient) SignCreateObjectApproval

func (s *GfSpClient) SignCreateObjectApproval(
	ctx context.Context,
	object *storagetypes.MsgCreateObject) (
	[]byte, error)

func (*GfSpClient) SignIntegrityHash

func (s *GfSpClient) SignIntegrityHash(
	ctx context.Context,
	objectID uint64,
	checksums [][]byte) (
	[]byte, []byte, error)

func (*GfSpClient) SignP2PPingMsg

func (s *GfSpClient) SignP2PPingMsg(
	ctx context.Context,
	ping *gfspp2p.GfSpPing) (
	[]byte, error)

func (*GfSpClient) SignP2PPongMsg

func (s *GfSpClient) SignP2PPongMsg(
	ctx context.Context,
	pong *gfspp2p.GfSpPong) (
	[]byte, error)

func (*GfSpClient) SignReceiveTask

func (s *GfSpClient) SignReceiveTask(
	ctx context.Context,
	receiveTask coretask.ReceivePieceTask) (
	[]byte, error)

func (*GfSpClient) SignReplicatePieceApproval

func (s *GfSpClient) SignReplicatePieceApproval(
	ctx context.Context,
	task coretask.ApprovalReplicatePieceTask) (
	[]byte, error)

func (*GfSpClient) SignerConn

func (s *GfSpClient) SignerConn(
	ctx context.Context,
	opts ...grpc.DialOption) (
	*grpc.ClientConn, error)

func (*GfSpClient) UploadObject

func (s *GfSpClient) UploadObject(
	ctx context.Context,
	task coretask.UploadObjectTask,
	stream io.Reader) error

func (*GfSpClient) VerifyAuthorize

func (s *GfSpClient) VerifyAuthorize(ctx context.Context,
	auth coremodule.AuthOpType, account, bucket, object string) (bool, error)

func (*GfSpClient) VerifyPermission

func (s *GfSpClient) VerifyPermission(
	ctx context.Context,
	Operator string,
	bucketName string,
	objectName string,
	actionType permission_types.ActionType,
	opts ...grpc.DialOption) (*permission_types.Effect, error)

VerifyPermission Verify the input account’s permission to input items

Jump to

Keyboard shortcuts

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