Documentation ¶
Overview ¶
Package types provides type definition of the greenfield-go-sdk client
Index ¶
- Constants
- Variables
- func CompareFiles(fileL string, fileR string) (bool, error)
- func ConstructErrResponse(r *http.Response, bucketName, objectName string) error
- func RandStr(n int) string
- func ToInvalidArgumentResp(message string) error
- type Account
- type BucketMeta
- type BucketMetaWithVGF
- type BuyQuotaOption
- type CancelCreateOption
- type CancelMigrateBucketOptions
- type CancelUpdateObjectOption
- type ChallengeResult
- type ChallengeV2Result
- type ComputeHashOptions
- type CreateBucketOptions
- type CreateGroupOptions
- type CreateObjectOptions
- type CreateStorageProviderOptions
- type DeleteBucketOption
- type DeleteGroupOption
- type DeleteObjectOption
- type DeletePolicyOption
- type EndPointOptions
- type ErrResponse
- type GetChallengeInfoOptions
- type GetObjectOptions
- type GetSecondaryPieceOptions
- type GlobalVirtualGroupFamily
- type GrantDepositForStorageProviderOptions
- type GroupMembers
- type GroupMembersPaginationOptions
- type GroupMembersResult
- type GroupMeta
- type GroupsOwnerPaginationOptions
- type GroupsPaginationOptions
- type GroupsResult
- type LeaveGroupOption
- type ListBucketsByBucketIDResponse
- type ListBucketsByPaymentAccountOptions
- type ListBucketsByPaymentAccountResult
- type ListBucketsOptions
- type ListBucketsResult
- type ListGroupsByGroupIDResponse
- type ListGroupsOptions
- type ListGroupsResult
- type ListObjectPoliciesOptions
- type ListObjectPoliciesResponse
- type ListObjectsByObjectIDResponse
- type ListObjectsOptions
- type ListObjectsResult
- type ListReadRecordOptions
- type ListUserPaymentAccountsOptions
- type ListUserPaymentAccountsResult
- type MigrateBucketOptions
- type MigrationProgress
- type NewStatementOptions
- type ObjectAndBucketIDs
- type ObjectDetail
- type ObjectMeta
- type ObjectStat
- type PaymentAccount
- type PaymentAccounts
- type PolicyMeta
- type Principal
- type PutObjectOptions
- type PutPolicyOption
- type QueryPieceInfo
- type QuotaInfo
- type QuotaRecordInfo
- type ReadRecord
- type RenewGroupMemberOption
- type SetBucketFlowRateLimitOption
- type SetTagsOptions
- type StorageProvider
- type StreamRecord
- type SubmitProposalOptions
- type TransferDetail
- type UpdateBucketOptions
- type UpdateGroupMemberOption
- type UpdateObjectOption
- type UpdateObjectOptions
- type UpdatePaymentOption
- type UpdateVisibilityOption
- type UploadOffset
- type UploadProgress
- type VirtualGroupFamily
- type VoteProposalOptions
Constants ¶
const ( Version = "v0.1.0" UserAgent = "Greenfield (" + runtime.GOOS + "; " + runtime.GOARCH + ") " + libName + "/" + Version HTTPHeaderAuthorization = "Authorization" HTTPHeaderContentLength = "Content-Length" HTTPHeaderContentMD5 = "Content-MD5" HTTPHeaderContentType = "Content-Type" HTTPHeaderTransactionHash = "X-Gnfd-Txn-Hash" HTTPHeaderUnsignedMsg = "X-Gnfd-Unsigned-Msg" HTTPHeaderSignedMsg = "X-Gnfd-Signed-Msg" HTTPHeaderPieceIndex = "X-Gnfd-Piece-Index" HTTPHeaderRedundancyIndex = "X-Gnfd-Redundancy-Index" HTTPHeaderObjectID = "X-Gnfd-Object-ID" HTTPHeaderIntegrityHash = "X-Gnfd-Integrity-Hash" HTTPHeaderPieceHash = "X-Gnfd-Piece-Hash" HTTPHeaderDate = "X-Gnfd-Date" HTTPHeaderEtag = "ETag" HTTPHeaderRange = "Range" HTTPHeaderUserAgent = "User-Agent" HTTPHeaderContentSHA256 = "X-Gnfd-Content-Sha256" HTTPHeaderUserAddress = "X-Gnfd-User-Address" ContentTypeXML = "application/xml" ContentDefault = "application/octet-stream" // EmptyStringSHA256 is the hex encoded sha256 value of an empty string EmptyStringSHA256 = `e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855` Iso8601DateFormatSecond = "2006-01-02T15:04:05Z" AdminURLPrefix = "/greenfield/admin" AdminURLV1Version = "/v1" AdminURLV2Version = "/v2" AdminV1Version = 1 AdminV2Version = 2 CreateObjectAction = "CreateObject" CreateBucketAction = "CreateBucket" MigrateBucketAction = "MigrateBucket" ChallengeUrl = "challenge" PrimaryRedundancyIndex = -1 ContextTimeout = time.Second * 30 MaxHeadTryTime = 4 HeadBackOffDelay = time.Millisecond * 500 NoSuchObjectErr = "object has not been created" GetConnectionFail = "connection refused" MaxDownloadTryTime = 3 DownloadBackOffDelay = time.Millisecond * 500 // MinPartSize - minimum part size 32MiB per object after which // putObject behaves internally as multipart. MinPartSize = 1024 * 1024 * 32 TempFileSuffix = ".temp" // Temp file suffix FilePermMode = os.FileMode(0o664) // Default file permission WaitTxContextTimeOut = 1 * time.Second DefaultExpireSeconds = 1000 )
Variables ¶
var ( ErrorDefaultAccountNotExist = errors.New("Default account of client is not exist ") ErrorProposalIDNotFound = errors.New("Proposal ID not found ") )
Functions ¶
func ConstructErrResponse ¶
ConstructErrResponse checks the response is an error response
func ToInvalidArgumentResp ¶
ToInvalidArgumentResp returns invalid argument response.
Types ¶
type Account ¶
type Account struct {
// contains filtered or unexported fields
}
Account indicates the user's identity information used for interaction with Greenfield.
func NewAccount ¶
NewAccount - Create a random new account.
-name: The account name.
-ret1: The pointer of the created account instance.
-ret2: The private key of the created account.
-ret3: Error message.
func NewAccountFromMnemonic ¶
NewAccountFromMnemonic - Create account instance according to mnemonic.
-name: Account name.
-mnemonic: The mnemonic string.
-ret1: The pointer of the created account instance.
-ret2: Error message if the mnemonic is not correct, otherwise returns nil.
func NewAccountFromPrivateKey ¶
NewAccountFromPrivateKey - Create account instance according to private key.
-name: Account name.
-privKey: Private key.
-ret1: The pointer of the created account instance.
-ret2: Error message if the privKey is not correct, otherwise returns nil.
func NewBlsAccount ¶ added in v0.2.3
NewBlsAccount - Create a random new account with bls key pairs.
-name: The account name.
-ret1: The pointer of the created account instance.
-ret2: The bls private key of the created account.
-ret3: Error message.
func (*Account) GetAddress ¶
func (a *Account) GetAddress() sdk.AccAddress
GetAddress - Get the address of the account.
func (*Account) GetKeyManager ¶
func (a *Account) GetKeyManager() keys.KeyManager
GetKeyManager - Get the key manager of the account.
type BucketMeta ¶
type BucketMeta struct { // BucketInfo defines the information of the bucket. BucketInfo *storageType.BucketInfo `xml:"BucketInfo"` // Removed defines the bucket is deleted or not Removed bool `xml:"Removed"` // DeleteAt defines the block number when the bucket deleted. DeleteAt int64 `xml:"DeleteAt"` // DeleteReason defines the deleted reason of bucket DeleteReason string `xml:"DeleteReason"` // Operator defines the operator address of bucket Operator string `xml:"Operator"` // CreateTxHash defines the creation transaction hash of bucket CreateTxHash string `xml:"CreateTxHash"` // UpdateTxHash defines the update transaction hash of bucket UpdateTxHash string `xml:"UpdateTxHash"` // UpdateAt defines the block number when the bucket updated UpdateAt int64 `xml:"UpdateAt"` // UpdateTime defines the block number when the bucket updated UpdateTime int64 `xml:"UpdateTime"` // OffChainStatus represents the status of a bucket in the off-chain storage. // It is used to track the current state of the bucket with respect to off-chain operations, // 1 means 0001 -> OffChainStatusIsLimited is true // 0 means 0000 -> OffChainStatusIsLimited is false // For an explanation of the different OffChainStatus values, please visit:https://github.com/bnb-chain/greenfield-storage-provider/blob/9d7048ad33cf51a2f7eb347e2113c5d0cc45f970/modular/blocksyncer/modules/bucket/bucket_handle.go#L40 OffChainStatus int32 `xml:"OffChainStatus"` }
BucketMeta is the structure for metadata service user bucket
type BucketMetaWithVGF ¶ added in v0.2.5
type BucketMetaWithVGF struct { // BucketInfo defines the information of the bucket. BucketInfo *storageType.BucketInfo `xml:"BucketInfo"` // Removed defines the bucket is deleted or not Removed bool `xml:"Removed"` // DeleteAt defines the block number when the bucket deleted. DeleteAt int64 `xml:"DeleteAt"` // DeleteReason defines the deleted reason of bucket DeleteReason string `xml:"DeleteReason"` // Operator defines the operator address of bucket Operator string `xml:"Operator"` // CreateTxHash defines the creation transaction hash of bucket CreateTxHash string `xml:"CreateTxHash"` // UpdateTxHash defines the update transaction hash of bucket UpdateTxHash string `xml:"UpdateTxHash"` // UpdateAt defines the block number when the bucket updated UpdateAt int64 `xml:"UpdateAt"` // UpdateTime defines the block number when the bucket updated UpdateTime int64 `xml:"UpdateTime"` // Vgf serve as a means of grouping global virtual groups. Vgf *GlobalVirtualGroupFamily `xml:"Vgf"` // OffChainStatus represents the status of a bucket in the off-chain storage. // It is used to track the current state of the bucket with respect to off-chain operations, // 1 means 0001 -> OffChainStatusIsLimited is true // 0 means 0000 -> OffChainStatusIsLimited is false // For an explanation of the different OffChainStatus values, please visit:https://github.com/bnb-chain/greenfield-storage-provider/blob/9d7048ad33cf51a2f7eb347e2113c5d0cc45f970/modular/blocksyncer/modules/bucket/bucket_handle.go#L40 OffChainStatus int32 `xml:"OffChainStatus"` }
BucketMetaWithVGF BucketMeta is the structure for metadata service user bucket
type BuyQuotaOption ¶
type BuyQuotaOption struct {
TxOpts *gnfdsdktypes.TxOption // TxOpts defines the options to customize a transaction.
}
BuyQuotaOption indicates the metadata to construct `UpdateBucketInfo` msg of storage module.
type CancelCreateOption ¶
type CancelCreateOption struct {
TxOpts *gnfdsdktypes.TxOption // TxOpts defines the options to customize a transaction.
}
CancelCreateOption indicates the metadata to construct `CancelCreateObject` msg of storage module.
type CancelMigrateBucketOptions ¶ added in v0.2.4
type CancelMigrateBucketOptions struct { TxOpts *gnfdsdktypes.TxOption IsAsyncMode bool // indicate whether to create the bucket in asynchronous mode }
CancelMigrateBucketOptions indicates the metadata to construct `CancelMigrateBucket` msg of storage module.
type CancelUpdateObjectOption ¶ added in v1.6.0
type CancelUpdateObjectOption struct {
TxOpts *gnfdsdktypes.TxOption // TxOpts defines the options to customize a transaction.
}
CancelUpdateObjectOption indicates the metadata to construct `CancelUpdateObjectContent` msg of storage module.
type ChallengeResult ¶
type ChallengeResult struct { IntegrityHash string // the integrity hash of the challenged object PieceData io.ReadCloser // the data of the segment/piece being challenged PiecesHash []string // the hashes of the object's segments/pieces }
ChallengeResult includes the integrity hash, data results and hashes for storage provide to respond to challenges.
type ChallengeV2Result ¶ added in v1.1.0
type ChallengeV2Result struct { XMLName xml.Name `xml:"GetChallengeInfo"` Version string `xml:"version,attr"` ObjectID string `xml:"ObjectID"` // ObjectID defines the object id of the challenge request RedundancyIndex string `xml:"RedundancyIndex"` // RedundancyIndex defines the redundancy index of the challenge request PieceIndex string `xml:"PieceIndex"` // PieceIndex defines the piece index of the challenge request IntegrityHash string `xml:"IntegrityHash"` // IntegrityHash defines the integrity hash of the object PieceHash string `xml:"PieceHash"` // PieceHash defines the return piece hashes of the object PieceData string `xml:"PieceData"` // PieceData defines the return piece data of challenge request }
ChallengeV2Result indicates the response info of challenge v2 API
type ComputeHashOptions ¶
ComputeHashOptions indicates the metadata of redundancy strategy.
type CreateBucketOptions ¶
type CreateBucketOptions struct { Visibility storageTypes.VisibilityType // Visibility defines the bucket public status. TxOpts *gnfdsdktypes.TxOption // TxOpts defines the options to customize a transaction. PaymentAddress string // PaymentAddress indicates the HEX-encoded string of the payment address. ChargedQuota uint64 // ChargedQuota defines the read data that users are charged for, measured in bytes. IsAsyncMode bool // indicate whether to create the bucket in asynchronous mode. Tags *storageTypes.ResourceTags // set tags when creating bucket }
CreateBucketOptions indicates the metadata to construct `CreateBucket` msg of storage module.
type CreateGroupOptions ¶
type CreateGroupOptions struct { Extra string // Extra defines the extra meta for a group. TxOpts *gnfdsdktypes.TxOption // TxOpts defines the options to customize a transaction. Tags *storageTypes.ResourceTags // set tags when creating bucket }
CreateGroupOptions indicates the metadata to construct `CreateGroup` msg.
type CreateObjectOptions ¶
type CreateObjectOptions struct { Visibility storageTypes.VisibilityType // Visibility defines the bucket public status. TxOpts *gnfdsdktypes.TxOption // TxOpts defines the options to customize a transaction. SecondarySPAccs []sdk.AccAddress // SecondarySPAccs indicates a list of secondary Storage Provider's addresses. ContentType string // ContentType defines the content type of object. IsReplicaType bool // IsReplicaType indicates whether the object uses REDUNDANCY_REPLICA_TYPE. IsAsyncMode bool // IsAsyncMode indicate whether to create the object in asynchronous mode. IsSerialComputeMode bool // IsSerialComputeMode indicate whether to compute integrity hash in serial way or parallel way when creating an object. Tags *storageTypes.ResourceTags // set tags when creating bucket }
CreateObjectOptions - indicates the metadata to construct `createObject` message of storage module.
type CreateStorageProviderOptions ¶
type CreateStorageProviderOptions struct { ReadPrice sdk.Dec // ReadPrice defines the storage provider's read price, in bnb wei per charge byte. FreeReadQuota uint64 // FreeReadQuota defines the free read quota of the SP. StorePrice sdk.Dec // StorePrice defines the store price of the SP, in bnb wei per charge byte. ProposalDepositAmount math.Int // ProposalDepositAmount defines the amount needed for a proposal. ProposalTitle string ProposalSummary string ProposalMetaData string TxOpts gnfdsdktypes.TxOption // TxOpts defines the options to customize a transaction. }
CreateStorageProviderOptions indicates the metadata to construct `CreateStorageProvider` msg.
type DeleteBucketOption ¶
type DeleteBucketOption struct {
TxOpts *gnfdsdktypes.TxOption // TxOpts defines the options to customize a transaction.
}
DeleteBucketOption indicates the metadata to construct `DeleteBucket` msg.
type DeleteGroupOption ¶
type DeleteGroupOption struct {
TxOpts *gnfdsdktypes.TxOption // TxOpts defines the options to customize a transaction.
}
DeleteGroupOption indicates the metadata to construct `DeleteGroup` msg of storage module.
type DeleteObjectOption ¶
type DeleteObjectOption struct {
TxOpts *gnfdsdktypes.TxOption // TxOpts defines the options to customize a transaction.
}
DeleteObjectOption indicates the metadata to construct `DeleteObject` msg of storage module.
type DeletePolicyOption ¶
type DeletePolicyOption struct {
TxOpts *gnfdsdktypes.TxOption // TxOpts defines the options to customize a transaction.
}
DeletePolicyOption indicates the metadata to construct `DeletePolicy` msg of storage module.
type EndPointOptions ¶ added in v0.2.3
type EndPointOptions struct { Endpoint string // Endpoint indicates the endpoint of sp. SPAddress string // SPAddress indicates the HEX-encoded string of the sp address to be challenged. }
EndPointOptions contains the options for querying a specified SP.
type ErrResponse ¶
type ErrResponse struct { XMLName xml.Name `xml:"Error"` Code string `xml:"Code"` Message string `xml:"Message"` StatusCode int }
ErrResponse define the information of the error response
type GetChallengeInfoOptions ¶
type GetChallengeInfoOptions struct { Endpoint string // Endpoint indicates the endpoint of sp SPAddress string // SPAddress indicates the HEX-encoded string of the sp address to be challenged. UseV2version bool // UseV2version indicates whether using of the v2 version get-challenge API }
GetChallengeInfoOptions contains the options for querying challenge data.
type GetObjectOptions ¶ added in v0.2.3
type GetObjectOptions struct { Range string `url:"-" header:"Range,omitempty"` // Range support for downloading partial data. SupportResumable bool // SupportResumable support resumable download. Resumable downloads refer to the capability of resuming interrupted or incomplete downloads from the point where they were paused or disrupted. PartSize uint64 // PartSize indicate the resumable download's part size, download a large file in multiple parts. The part size is an integer multiple of the segment size. }
GetObjectOptions contains the options for `GetObject` API.
func (*GetObjectOptions) SetRange ¶ added in v0.2.3
func (o *GetObjectOptions) SetRange(start, end int64) error
type GetSecondaryPieceOptions ¶ added in v0.2.3
type GetSecondaryPieceOptions struct { Endpoint string // Endpoint indicates the endpoint of sp. SPAddress string // SPAddress indicates the HEX-encoded string of the sp address to be challenged. }
GetSecondaryPieceOptions contains the options for `GetSecondaryPiece` API.
type GlobalVirtualGroupFamily ¶ added in v0.2.5
type GlobalVirtualGroupFamily struct { // Id is the identifier of the global virtual group family. Id uint32 `xml:"Id"` // PrimarySpId is the id of primary sp PrimarySpId uint32 `xml:"PrimarySpId"` // GlobalVirtualGroupIds is a list of identifiers of the global virtual groups associated with the family. GlobalVirtualGroupIds []uint32 `xml:"GlobalVirtualGroupIds"` // VirtualPaymentAddress is the payment address associated with the global virtual group family. VirtualPaymentAddress string `xml:"VirtualPaymentAddress"` }
GlobalVirtualGroupFamily serve as a means of grouping global virtual groups. Each bucket must be associated with a unique global virtual group family and cannot cross families.
type GrantDepositForStorageProviderOptions ¶
type GrantDepositForStorageProviderOptions struct { Expiration *time.Time // Expiration defines the expiration time of grant. TxOpts gnfdsdktypes.TxOption // TxOpts defines the options to customize a transaction. }
GrantDepositForStorageProviderOptions indicates the metadata to construct `Grant` msg.
type GroupMembers ¶ added in v0.2.4
type GroupMembers struct { // Group defines the basic group info Group *storageType.GroupInfo `xml:"Group"` // Operator defines operator address of group Operator string `xml:"Operator"` // CreateAt defines the block number when the group created CreateAt int64 `xml:"CreateAt"` // CreateTime defines the timestamp when the group created CreateTime int64 `xml:"CreateTime"` // UpdateAt defines the block number when the group updated UpdateAt int64 `xml:"UpdateAt"` // UpdateTime defines the timestamp when the group updated UpdateTime int64 `xml:"UpdateTime"` // Removed defines the group is deleted or not Removed bool `xml:"Removed"` // AccountID defines the address of account AccountID string `xml:"AccountId"` // ExpirationTime is the user expiration time for this group ExpirationTime string `xml:"ExpirationTime"` }
GroupMembers indicates the group member info
type GroupMembersPaginationOptions ¶ added in v0.2.4
type GroupMembersPaginationOptions struct { // Limit determines the number of group data records to be returned. // If the limit is set to 0, it will default to 50. // If the limit exceeds 1000, only 1000 records will be returned. Limit int64 StartAfter string // StartAfter is used to input the user's account address for pagination purposes. Endpoint string // indicates the endpoint of sp. SPAddress string // indicates the HEX-encoded string of the sp address to be challenged. }
GroupMembersPaginationOptions contains the options for `ListGroupMembers` API.
type GroupMembersResult ¶ added in v0.2.4
type GroupMembersResult struct { // Groups defines the response of group member list Groups []*GroupMembers `xml:"Groups"` }
GroupMembersResult indicates the response of ListGroupMembers
type GroupMeta ¶ added in v0.2.2
type GroupMeta struct { // Group defines the basic group info Group *storageType.GroupInfo `xml:"Group"` // NumberOfMembers defines how many members in this group NumberOfMembers int64 `xml:"NumberOfMembers"` // Operator defines operator address of group Operator string `xml:"Operator"` // CreateAt defines the block number when the group created CreateAt int64 `xml:"CreateAt"` // CreateTime defines the timestamp when the group created CreateTime int64 `xml:"CreateTime"` // UpdateAt defines the block number when the group updated UpdateAt int64 `xml:"UpdateAt"` // UpdateTime defines the timestamp when the group updated UpdateTime int64 `xml:"UpdateTime"` // Removed defines the group is deleted or not Removed bool `xml:"Removed"` }
GroupMeta is the structure for group information
type GroupsOwnerPaginationOptions ¶ added in v0.2.4
type GroupsOwnerPaginationOptions struct { // Limit determines the number of group data records to be returned. // If the limit is set to 0, it will default to 50. // If the limit exceeds 1000, only 1000 records will be returned. Limit int64 StartAfter string // StartAfter is used to input the group id for pagination purposes. Owner string // Owner defines the owner account address of groups, if owner is set to "", it will default to current user address. Endpoint string // Endpoint indicates the endpoint of sp. SPAddress string // SPAddress indicates the HEX-encoded string of the sp address to be challenged. }
GroupsOwnerPaginationOptions contains the options for `ListGroupsByOwner` API.
type GroupsPaginationOptions ¶ added in v0.2.4
type GroupsPaginationOptions struct { // Limit determines the number of group data records to be returned. // If the limit is set to 0, it will default to 50. // If the limit exceeds 1000, only 1000 records will be returned. Limit int64 StartAfter string // StartAfter is used to input the group id for pagination purposes. Account string // Account defines the user account address, if it is set to "", it will default to the current user address. Endpoint string // Endpoint indicates the endpoint of sp. SPAddress string // SPAddress indicates the HEX-encoded string of the sp address to be challenged. }
GroupsPaginationOptions contains the options for `ListGroupsByAccount` API.
type GroupsResult ¶ added in v0.2.4
type GroupsResult struct { // Groups defines the response of group member list Groups []*GroupMembers `xml:"Groups"` }
GroupsResult indicates a list of group members
type LeaveGroupOption ¶
type LeaveGroupOption struct {
TxOpts *gnfdsdktypes.TxOption // TxOpts defines the options to customize a transaction.
}
LeaveGroupOption indicates the metadata to construct `LeaveGroup` msg of storage module.
type ListBucketsByBucketIDResponse ¶ added in v0.2.3
type ListBucketsByBucketIDResponse struct { // Buckets defines the information of a bucket map Buckets map[uint64]*BucketMeta `xml:"Buckets"` }
ListBucketsByBucketIDResponse is response type for the ListBucketsByBucketID
type ListBucketsByPaymentAccountOptions ¶ added in v0.2.5
type ListBucketsByPaymentAccountOptions struct { Endpoint string // Endpoint indicates the endpoint of sp. SPAddress string // SPAddress indicates the HEX-encoded string of the sp address to be challenged. }
ListBucketsByPaymentAccountOptions contains the options for `ListBucketsByPaymentAccount` API.
type ListBucketsByPaymentAccountResult ¶ added in v0.2.5
type ListBucketsByPaymentAccountResult struct { // Buckets defines the list of bucket Buckets []*BucketMeta `xml:"Buckets"` }
ListBucketsByPaymentAccountResult defines the response of list buckets by payment account
type ListBucketsOptions ¶ added in v0.2.3
type ListBucketsOptions struct { ShowRemovedBucket bool // ShowRemovedBucket determines whether to include buckets that have been marked as removed in the list. If set to false, these buckets will be skipped. Account string // Account defines the user account address, if it is set to "", it will default to the current user address. Endpoint string // Endpoint indicates the endpoint of sp. SPAddress string // SPAddress indicates the HEX-encoded string of the sp address to be challenged. }
ListBucketsOptions contains the options for `ListBuckets` API.
type ListBucketsResult ¶
type ListBucketsResult struct { // Buckets defines the list of bucket Buckets []*BucketMetaWithVGF `xml:"Buckets"` }
ListBucketsResult defines the response of list bucekts response
type ListGroupsByGroupIDResponse ¶ added in v0.2.6
type ListGroupsByGroupIDResponse struct { // Groups defines the information of a group map Groups map[uint64]*GroupMeta `xml:"Groups"` }
ListGroupsByGroupIDResponse is response type for the ListGroupsByGroupID
type ListGroupsOptions ¶ added in v0.2.2
type ListGroupsOptions struct { SourceType string // SourceType indicates the source type of group. Limit int64 Offset int64 Endpoint string // Endpoint indicates the endpoint of sp. SPAddress string // SPAddress indicates the HEX-encoded string of the sp address to be challenged. }
ListGroupsOptions contains the options for `ListGroups` API.
type ListGroupsResult ¶ added in v0.2.2
type ListGroupsResult struct { // Groups defines the response of group list Groups []*GroupMeta `json:"Groups"` // Count defines total groups amount Count int64 `xml:"Count"` }
ListGroupsResult define the response of list groups
type ListObjectPoliciesOptions ¶ added in v0.2.5
type ListObjectPoliciesOptions struct { // Limit determines the number of policies data records to be returned. // If the limit is set to 0, it will default to 50. // If the limit exceeds 1000, only 1000 records will be returned. Limit int64 StartAfter string // StartAfter is used to input the policy id for pagination purposes. Endpoint string // Endpoint indicates the endpoint of sp. SPAddress string // SPAddress indicates the HEX-encoded string of the sp address to be challenged. }
ListObjectPoliciesOptions contains the options for `ListObjectPolicies` API.
type ListObjectPoliciesResponse ¶ added in v0.2.5
type ListObjectPoliciesResponse struct {
Policies []*PolicyMeta `xml:"Policies"`
}
ListObjectPoliciesResponse define the response of list object policies
type ListObjectsByObjectIDResponse ¶ added in v0.2.3
type ListObjectsByObjectIDResponse struct { // objects defines the information of a object map Objects map[uint64]*ObjectMeta `xml:"Objects"` }
ListObjectsByObjectIDResponse is response type for the ListObjectsByObjectID
type ListObjectsOptions ¶
type ListObjectsOptions struct { // ShowRemovedObject determines whether to include objects that have been marked as removed in the list. // If set to false, these objects will be skipped. ShowRemovedObject bool // StartAfter defines the starting object name for the listing of objects. // The listing will start from the next object after the one named in this attribute. StartAfter string // ContinuationToken is the token returned from a previous list objects request to indicate where // in the list of objects to resume the listing. This is used for pagination. ContinuationToken string // Delimiter is a character that is used to group keys. // All keys that contain the same string between the prefix and the first occurrence of the delimiter // are grouped under a single result element in common prefixes. // It is used for grouping keys, currently only '/' is supported. Delimiter string // Prefix limits the response to keys that begin with the specified prefix. // You can use prefixes to separate a bucket into different sets of keys in a way similar to how a file // system uses folders. Prefix string // MaxKeys defines the maximum number of keys returned to the response body. // If not specified, the default value is 50. // The maximum limit for returning objects is 1000 MaxKeys uint64 Endpoint string // indicates the endpoint of sp. SPAddress string // indicates the HEX-encoded string of the sp address to be challenged. }
ListObjectsOptions contains the options for `ListObjects` API.
type ListObjectsResult ¶
type ListObjectsResult struct { // Objects defines the list of object Objects []*ObjectMeta `xml:"Objects"` // KeyCount is the number of keys returned with this request KeyCount string `xml:"KeyCount"` // MaxKeys sets the maximum number of keys returned to the response MaxKeys string `xml:"MaxKeys"` // IsTruncated set to false if all of the results were returned. set to true if more keys are available to return IsTruncated bool `xml:"IsTruncated"` // NextContinuationToken is sent when is_truncated is true, which means there are more keys in the bucket that can be listed NextContinuationToken string `xml:"NextContinuationToken"` // Name defines the name of the bucket Name string `xml:"Name"` // Prefix is the prefix used during the query Prefix string `xml:"Prefix"` // Delimiter is the delimiter used during the query Delimiter string `xml:"Delimiter"` // CommonPrefixes defines a list of strings representing common prefixes. common_prefixes are those parts of object key names that fall between the specified delimiters CommonPrefixes []string `xml:"CommonPrefixes"` // ContinuationToken is the continuation token used during the query ContinuationToken string `xml:"ContinuationToken"` }
ListObjectsResult indicates the result of listObjects API.
type ListReadRecordOptions ¶
type ListReadRecordOptions struct { StartTimeStamp int64 // StartTimeStamp indicates the start timestamp of the return read quota record. MaxRecords int }
ListReadRecordOptions contains the options for `ListBucketReadRecord` API.
type ListUserPaymentAccountsOptions ¶ added in v0.2.5
type ListUserPaymentAccountsOptions struct { Account string // Account defines the user account address, if it is set to "", it will default to the current user address. Endpoint string // Endpoint indicates the endpoint of sp. SPAddress string // SPAddress indicates the HEX-encoded string of the sp address to be challenged. }
ListUserPaymentAccountsOptions contains the options for `ListUserPaymentAccounts` API.
type ListUserPaymentAccountsResult ¶ added in v0.2.5
type ListUserPaymentAccountsResult struct { // PaymentAccount defines the list of payment accounts PaymentAccounts []*PaymentAccounts `xml:"PaymentAccounts"` }
ListUserPaymentAccountsResult defines the response of list user payment accounts
type MigrateBucketOptions ¶ added in v0.2.3
type MigrateBucketOptions struct { TxOpts *gnfdsdktypes.TxOption IsAsyncMode bool // indicate whether to create the bucket in asynchronous mode }
MigrateBucketOptions indicates the metadata to construct `MigrateBucket` msg of storage module.
type MigrationProgress ¶ added in v1.2.0
type MigrationProgress struct { XMLName xml.Name `xml:"QueryMigrationProgress"` Version string `xml:"version,attr"` // Version defines version info ProgressDescription string `xml:"ProgressDescription"` // ProgressDescription defines a string message representing the upload progress. ErrorDescription string `xml:"ErrorDescription"` // ErrorDescription defines a string message representing an upload error exception. MigratedBytes uint64 `xml:"MigratedBytes"` MigrationState uint64 `xml:"MigrationState"` }
MigrationProgress indicates the progress info of bucket migration
type NewStatementOptions ¶
type ObjectAndBucketIDs ¶ added in v0.2.3
type ObjectAndBucketIDs struct {
IDs []uint64 `xml:"IDs"`
}
ObjectAndBucketIDs is the structure for ListBucketsByBucketID & ListObjectsByObjectID request body
type ObjectDetail ¶ added in v0.2.3
type ObjectDetail struct { ObjectInfo *storagetypes.ObjectInfo `protobuf:"bytes,1,opt,name=object_info" json:"object_info,omitempty"` GlobalVirtualGroup *types.GlobalVirtualGroup `protobuf:"bytes,2,opt,name=global_virtual_group" json:"global_virtual_group,omitempty"` }
ObjectDetail contains the detailed info of the object stored on Greenfield.
func (*ObjectDetail) ProtoMessage ¶ added in v1.2.0
func (m *ObjectDetail) ProtoMessage()
func (*ObjectDetail) Reset ¶ added in v1.2.0
func (m *ObjectDetail) Reset()
func (*ObjectDetail) String ¶ added in v1.2.0
func (m *ObjectDetail) String() string
type ObjectMeta ¶
type ObjectMeta struct { // ObjectInfo defines the information of the object. ObjectInfo *storageType.ObjectInfo `xml:"ObjectInfo"` // LockedBalance defines locked balance of object LockedBalance string `xml:"LockedBalance"` // Removed defines the object is deleted or not Removed bool `xml:"Removed"` // UpdateAt defines the block number when the object updated UpdateAt int64 `xml:"UpdateAt"` // DeleteAt defines the block number when the object deleted DeleteAt int64 `xml:"DeleteAt"` // DeleteReason defines the deleted reason of object DeleteReason string `xml:"DeleteReason"` // Operator defines the operator address of object Operator string `xml:"Operator"` // CreateTxHash defines the creation transaction hash of object CreateTxHash string `xml:"CreateTxHash"` // UpdateTxHash defines the update transaction hash of object UpdateTxHash string `xml:"UpdateTxHash"` // SealTxHash defines the sealed transaction hash of object SealTxHash string `xml:"SealTxHash"` }
ObjectMeta is the structure for metadata service user object
type ObjectStat ¶
ObjectStat contains the metadata of the downloaded object.
type PaymentAccount ¶ added in v0.2.6
type PaymentAccount struct { // Address defines the address of payment account Address string `xml:"Address"` // Owner defines the owner of this payment account Owner string `xml:"Owner"` // Refundable defines the payment account is refundable or not Refundable bool `xml:"Refundable"` // UpdateAt defines the update block height of this payment account UpdateAt int64 `xml:"UpdateAt"` // UpdateTime defines the update time of this payment account UpdateTime int64 `xml:"UpdateTime"` }
PaymentAccount defines payment account info
type PaymentAccounts ¶ added in v0.2.6
type PaymentAccounts struct { // refundable defines the payment account is refundable or not PaymentAccount *PaymentAccount `xml:"PaymentAccount"` // stream_records defines stream payment records of a stream account StreamRecord *StreamRecord `xml:"StreamRecord"` }
type PolicyMeta ¶ added in v0.2.5
type PolicyMeta struct { // PrincipalType defines the type of principal PrincipalType int32 `xml:"PrincipalType"` // PrincipalValue defines the value of principal PrincipalValue string `xml:"PrincipalValue"` // ResourceType defines the type of resource that grants permission for ResourceType int32 `xml:"ResourceType"` // ResourceId defines the bucket/object/group id of the resource that grants permission for ResourceId string `xml:"ResourceId"` // CreateTimestamp defines the create time of permission CreateTimestamp int64 `xml:"CreateTimestamp"` // UpdateTimestamp defines the update time of permission UpdateTimestamp int64 `xml:"UpdateTimestamp"` // ExpirationTime defines the expiration time of permission ExpirationTime int64 `xml:"ExpirationTime"` }
PolicyMeta defines the policy info
type Principal ¶
type Principal string
Principal indicates the marshaled Principal content of greenfield permission types, user can generate it by NewPrincipalWithAccount or NewPrincipalWithGroupId method in utils.
type PutObjectOptions ¶
type PutObjectOptions struct { ContentType string // ContentType indicates the content type of object. TxnHash string // TxnHash indicates the transaction hash creating the object meta on chain. DisableResumable bool // DisableResumable indicates whether upload the object to Storage Provider via resumable upload. PartSize uint64 Delegated bool // Delegated indicates that the request to SP will require SP to create/update objet behalf of the uploader. IsUpdate bool // IsUpdate indicates that the request to SP is a delegated update object request. Visibility storageTypes.VisibilityType }
PutObjectOptions indicates the options for uploading an object to Storage Provider.
type PutPolicyOption ¶
type PutPolicyOption struct { TxOpts *gnfdsdktypes.TxOption // TxOpts defines the options to customize a transaction. PolicyExpireTime *time.Time // PolicyExpireTime defines the expiration timestamp of policy. }
PutPolicyOption indicates the metadata to construct `PutPolicy` msg of storage module.
type QueryPieceInfo ¶ added in v0.2.3
QueryPieceInfo indicates the challenge or recovery object piece info. If it is primary sp, the RedundancyIndex value should be -1, else it indicates the index of secondary sp.
type QuotaInfo ¶
type QuotaInfo struct { XMLName xml.Name `xml:"GetReadQuotaResult"` Version string `xml:"version,attr"` BucketName string `xml:"BucketName"` BucketID string `xml:"BucketID"` // BucketID defines the bucket read quota value on chain ReadQuotaSize uint64 `xml:"ReadQuotaSize"` // ReadQuotaSize defines the bucket read quota value on chain SPFreeReadQuotaSize uint64 `xml:"SPFreeReadQuotaSize"` // SPFreeReadQuotaSize defines the free quota of this month ReadConsumedSize uint64 `xml:"ReadConsumedSize"` // ReadConsumedSize defines the consumed total read quota of this month FreeConsumedSize uint64 `xml:"FreeConsumedSize"` // FreeConsumedSize defines the consumed free quota MonthlyFreeQuota uint64 `xml:"MonthlyFreeQuota"` // MonthlyFreeQuota defines the consumed monthly free quota MonthlyFreeConsumedSize uint64 `xml:"MonthlyQuotaConsumedSize"` // MonthlyFreeConsumedSize defines the consumed monthly free quota }
QuotaInfo indicates the quota info of bucket
type QuotaRecordInfo ¶
type QuotaRecordInfo struct { XMLName xml.Name `xml:"GetBucketReadQuotaResult"` Version string `xml:"version,attr"` // The Version defines version info // When using ListBucketReadRecord to list items, if the returned results do not cover all items, the NextStartTimestampUs will be returned to indicate the timestamp of the current traversal progress. // When you call the ListBucketReadRecord again, you can set opt.StartTimeStamp to this timestamp. NextStartTimestampUs int64 `xml:"NextStartTimestampUs"` // ReadRecords defines the result record list. ReadRecords []ReadRecord `xml:"ReadRecord"` }
QuotaRecordInfo indicates the quota read record
type ReadRecord ¶
type ReadRecord struct { XMLName xml.Name `xml:"ReadRecord"` ObjectName string `xml:"ObjectName"` // ObjectName The download object name ObjectID string `xml:"ObjectID"` // ObjectID The download object id ReadAccountAddress string `xml:"ReadAccountAddress"` // ReadAccountAddress The sender address of the download request ReadTimestampUs int64 `xml:"ReadTimestampUs"` // ReadTimestampUs The download time stamp ReadSize uint64 `xml:"ReadSize"` // ReadSize The download object size }
ReadRecord indicate the download record info
type RenewGroupMemberOption ¶ added in v0.2.4
type RenewGroupMemberOption struct { TxOpts *gnfdsdktypes.TxOption // TxOpts defines the options to customize a transaction. ExpirationTime []*time.Time // ExpirationTime defines a list of expiration time for each group member to be updated. }
RenewGroupMemberOption indicates the metadata to construct `RenewGroupMember` msg of storage module.
type SetBucketFlowRateLimitOption ¶ added in v1.6.0
type SetBucketFlowRateLimitOption struct {
TxOpts *gnfdsdktypes.TxOption // TxOpts defines the options to customize a transaction.
}
SetBucketFlowRateLimitOption indicates the metadata to construct `SetBucketFlowRateLimit` msg.
type SetTagsOptions ¶ added in v1.2.0
type SetTagsOptions struct {
TxOpts *gnfdsdktypes.TxOption // TxOpts defines the options to customize a transaction.
}
type StorageProvider ¶ added in v0.2.3
type StorageProvider struct { Id uint32 OperatorAddress sdk.AccAddress FundingAddress sdk.AccAddress SealAddress sdk.AccAddress ApprovalAddress sdk.AccAddress GcAddress sdk.AccAddress Status spTypes.Status EndPoint *url.URL Description spTypes.Description BlsKey []byte }
StorageProvider indicates the metadata of SP that stored on-chain.
type StreamRecord ¶ added in v0.2.5
type StreamRecord struct { // Account address Account string `xml:"Account"` // CrudTimestamp defines latest update timestamp of the stream record CrudTimestamp int64 `xml:"CrudTimestamp"` // NetflowRate defines The per-second rate that an account's balance is changing. // It is the sum of the account's inbound and outbound flow rates. NetflowRate int64 `xml:"NetflowRate"` // StaticBalance defines The balance of the stream account at the latest CRUD timestamp. StaticBalance int64 `xml:"StaticBalance"` // BufferBalance defines reserved balance of the stream account // If the netflow rate is negative, the reserved balance is `netflow_rate * reserve_time` BufferBalance int64 `xml:"BufferBalance"` // LockBalance defines the locked balance of the stream account after it puts a new object and before the object is sealed LockBalance int64 `xml:"LockBalance"` // Status defines the status of the stream account Status int32 `xml:"Status"` // SettleTimestamp defines the unix timestamp when the stream account will be settled SettleTimestamp int64 `xml:"SettleTimestamp"` // OutFlowCount defines the count of its out flows OutFlowCount uint64 `xml:"OutFlowCount"` // FrozenNetflowRate defines the frozen netflow rate, which is used when resuming stream account FrozenNetflowRate int64 `xml:"FrozenNetflowRate"` }
StreamRecord defines Record of a stream account
type SubmitProposalOptions ¶
type SubmitProposalOptions struct { Metadata string // metadata efines the metadata to be submitted along with the proposal. TxOpts gnfdsdktypes.TxOption // TxOpts defines the options to customize a transaction. }
SubmitProposalOptions indicates the metadata to construct `SubmitProposal` msg.
type TransferDetail ¶
TransferDetail includes the target address and amount for token transfer.
type UpdateBucketOptions ¶
type UpdateBucketOptions struct { Visibility storageTypes.VisibilityType // Visibility defines the bucket public status. TxOpts *gnfdsdktypes.TxOption // TxOpts defines the options to customize a transaction. PaymentAddress string // PaymentAddress defines the HEX-encoded string of the payment address. ChargedQuota *uint64 // ChargedQuota defines the read data that users are charged for, measured in bytes. }
UpdateBucketOptions indicates the metadata to construct `UpdateBucketInfo` msg of storage module.
type UpdateGroupMemberOption ¶
type UpdateGroupMemberOption struct { TxOpts *gnfdsdktypes.TxOption // TxOpts defines the options to customize a transaction. ExpirationTime []*time.Time // ExpirationTime defines a list of expiration time for each group member to be updated. }
UpdateGroupMemberOption indicates the metadata to construct `UpdateGroupMembers` msg.
type UpdateObjectOption ¶
type UpdateObjectOption struct {
TxOpts *gnfdsdktypes.TxOption // TxOpts defines the options to customize a transaction.
}
UpdateObjectOption indicates the metadata to construct `UpdateObjectInfo` msg of storage module.
type UpdateObjectOptions ¶ added in v1.6.0
type UpdateObjectOptions struct { TxOpts *gnfdsdktypes.TxOption // TxOpts defines the options to customize a transaction. SecondarySPAccs []sdk.AccAddress // SecondarySPAccs indicates a list of secondary Storage Provider's addresses. ContentType string // ContentType defines the content type of object. IsReplicaType bool // IsReplicaType indicates whether the object uses REDUNDANCY_REPLICA_TYPE. IsAsyncMode bool // IsAsyncMode indicate whether to update the object in asynchronous mode. IsSerialComputeMode bool // IsSerialComputeMode indicate whether to compute integrity hash in serial way or parallel way when creating an object. }
UpdateObjectOptions - indicates the metadata to construct `updateObjectContent` message of storage module.
type UpdatePaymentOption ¶
type UpdatePaymentOption struct {
TxOpts *gnfdsdktypes.TxOption // TxOpts defines the options to customize a transaction.
}
UpdatePaymentOption indicates the metadata to construct `UpdateBucketInfo` msg.
type UpdateVisibilityOption ¶
type UpdateVisibilityOption struct {
TxOpts *gnfdsdktypes.TxOption // TxOpts defines the options to customize a transaction.
}
UpdateVisibilityOption indicates the metadata to construct `UpdateBucketInfo` msg of storage module.
type UploadOffset ¶ added in v0.2.3
type UploadOffset struct { XMLName xml.Name `xml:"QueryResumeOffset"` Version string `xml:"version,attr"` // Version defines version info Offset uint64 `xml:"Offset"` // Offset defines the offset info of resumable uploading object }
UploadOffset indicates the offset of resumable uploading object
type UploadProgress ¶
type UploadProgress struct { XMLName xml.Name `xml:"QueryUploadProgress"` Version string `xml:"version,attr"` // Version defines version info ProgressDescription string `xml:"ProgressDescription"` // ProgressDescription defines a string message representing the upload progress. ErrorDescription string `xml:"ErrorDescription"` // ErrorDescription defines a string message representing an upload error exception. }
UploadProgress indicates the progress info of uploading object
type VirtualGroupFamily ¶ added in v1.7.0
type VoteProposalOptions ¶
type VoteProposalOptions struct { Metadata string // Metadata defines the metadata to be submitted along with the vote. TxOpts gnfdsdktypes.TxOption // TxOpts defines the options to customize a transaction. }
VoteProposalOptions indicates the metadata to construct `VoteProposal` msg.