metadata

package
v0.2.5-alpha.2 Latest Latest
Warning

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

Go to latest
Published: Sep 7, 2023 License: GPL-3.0 Imports: 29 Imported by: 0

README

Metadata

Metadata service is to supply better query service for the Inscription network. Users can interact with SP for some complex query services. Some interfaces can be costly to implement on the chain or can cause significant latency. metadata service is designed to implement the corresponding interface under the chain and provide it to the SP to achieve high performance and low latency. The events' data are optimally stored by the block syncer and provided to the metadata. Also, it provides additional extensions such as Pagination, Sort Key, and filtering. etc.

Role

Sync all the Greenfield chain data to the distributed stores, and offers the read RPC requests for chain data(in addition to payload). SP service will query the info, E.g. permission, ListBucket, ListObject, etc. It will reduce the pressure on the Greenfield chain.

Scalability

At present, the main role of metadata is to provide better scalability, and two main points are considered in the process of interface development:

  1. the creation of interfaces that are not currently supported on the chain
  2. metadata can provide better performance and low latency interfaces compared to those on the chain

Documentation

Index

Constants

View Source
const (
	// DefaultQuerySPParallelPerNode defines the max parallel for retrieving request
	DefaultQuerySPParallelPerNode int64 = 10240
	// DefaultBsDBSwitchCheckIntervalSec defines the default db switch check interval in seconds
	DefaultBsDBSwitchCheckIntervalSec = 30
)
View Source
const (
	DefaultMetadataStatisticsInterval = 60
)

Variables

View Source
var (
	ErrDanglingPointer   = gfsperrors.Register(coremodule.MetadataModularName, http.StatusBadRequest, 90001, "OoooH... request lost, try again later")
	ErrExceedRequest     = gfsperrors.Register(coremodule.MetadataModularName, http.StatusNotAcceptable, 90002, "request exceed")
	ErrNoRecord          = gfsperrors.Register(coremodule.MetadataModularName, http.StatusNotFound, 90003, "no uploading record")
	ErrNoSuchSP          = gfsperrors.Register(coremodule.MetadataModularName, http.StatusNotFound, 90004, "no such sp")
	ErrExceedBlockHeight = gfsperrors.Register(coremodule.MetadataModularName, http.StatusBadRequest, 90005, "request block height exceed latest height")
)
View Source
var (
	BsModules []string
	BsWorkers uint

	ChainID      string
	ChainAddress []string

	SpOperatorAddress string
	GatewayDomainName string
)
View Source
var (
	// ErrInvalidParams defines invalid params
	ErrInvalidParams = errors.New("invalid params")
	// ErrInvalidBucketName defines invalid bucket name
	ErrInvalidBucketName = errors.New("invalid bucket name")
	// ErrNoSuchBucket defines not existed bucket error
	ErrNoSuchBucket = errors.New("the specified bucket does not exist")
	// ErrNoSuchGroup defines not existed group error
	ErrNoSuchGroup = errors.New("the specified group does not exist")
	// ErrNoSuchObject defines not existed object error
	ErrNoSuchObject = errors.New("the specified key does not exist")
)

Functions

func DefaultMetadataOptions

func DefaultMetadataOptions(metadata *MetadataModular, cfg *gfspconfig.GfSpConfig) error

func ErrGfSpDBWithDetail added in v0.2.4

func ErrGfSpDBWithDetail(detail string) *gfsperrors.GfSpError

func NewMetadataModular

func NewMetadataModular(app *gfspapp.GfSpBaseApp, cfg *gfspconfig.GfSpConfig) (coremodule.Modular, error)

Types

type MetadataModular

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

func (*MetadataModular) GfSpGetBucketByBucketID

GfSpGetBucketByBucketID get buckets info by by a bucket id

func (*MetadataModular) GfSpGetBucketByBucketName

GfSpGetBucketByBucketName get buckets info by a bucket name

func (*MetadataModular) GfSpGetBucketMeta

func (r *MetadataModular) GfSpGetBucketMeta(
	ctx context.Context,
	req *types.GfSpGetBucketMetaRequest) (
	resp *types.GfSpGetBucketMetaResponse, err error)

GfSpGetBucketMeta get bucket metadata

func (*MetadataModular) GfSpGetBucketReadQuota

func (*MetadataModular) GfSpGetEndpointBySpID added in v0.2.4

GfSpGetEndpointBySpID get endpoint by sp id

func (*MetadataModular) GfSpGetGlobalVirtualGroup added in v0.2.3

GfSpGetGlobalVirtualGroup get global virtual group by lvg id and bucket id

func (*MetadataModular) GfSpGetGlobalVirtualGroupByGvgID added in v0.2.3

GfSpGetGlobalVirtualGroupByGvgID get global virtual group by gvg id

func (*MetadataModular) GfSpGetGroupList

GfSpGetGroupList get group list by queryName/prefix/sourceType

func (*MetadataModular) GfSpGetGroupMembers added in v0.2.4

GfSpGetGroupMembers get group members by group id

func (*MetadataModular) GfSpGetObjectMeta

GfSpGetObjectMeta get object metadata

func (*MetadataModular) GfSpGetPaymentByBucketID

GfSpGetPaymentByBucketID get bucket payment info by a bucket id

func (*MetadataModular) GfSpGetPaymentByBucketName

GfSpGetPaymentByBucketName get bucket payment info by a bucket name

func (*MetadataModular) GfSpGetSPInfo added in v0.2.3

func (r *MetadataModular) GfSpGetSPInfo(ctx context.Context, req *types.GfSpGetSPInfoRequest) (resp *types.GfSpGetSPInfoResponse, err error)

GfSpGetSPInfo get sp info by operator address

func (*MetadataModular) GfSpGetSPMigratingBucketNumber added in v0.2.5

GfSpGetSPMigratingBucketNumber get the latest active migrating bucket by specific sp

func (*MetadataModular) GfSpGetStatus added in v0.2.4

func (r *MetadataModular) GfSpGetStatus(ctx context.Context, req *types.GfSpGetStatusRequest) (resp *types.GfSpGetStatusResponse, err error)

func (*MetadataModular) GfSpGetUserBuckets

func (r *MetadataModular) GfSpGetUserBuckets(
	ctx context.Context,
	req *types.GfSpGetUserBucketsRequest) (
	resp *types.GfSpGetUserBucketsResponse, err error)

func (*MetadataModular) GfSpGetUserBucketsCount

GfSpGetUserBucketsCount get buckets count by a user address

func (*MetadataModular) GfSpGetUserGroups added in v0.2.4

GfSpGetUserGroups get groups info by a user address

func (*MetadataModular) GfSpGetUserOwnedGroups added in v0.2.4

GfSpGetUserOwnedGroups retrieve groups where the user is the owner

func (*MetadataModular) GfSpGetVirtualGroupFamily added in v0.2.3

GfSpGetVirtualGroupFamily get virtual group families by vgf id

func (*MetadataModular) GfSpListBucketsByIDs added in v0.2.4

GfSpListBucketsByIDs list buckets by bucket ids

func (*MetadataModular) GfSpListDeletedObjectsByBlockNumberRange

GfSpListDeletedObjectsByBlockNumberRange list deleted objects info by a block number range

func (*MetadataModular) GfSpListExpiredBucketsBySp

GfSpListExpiredBucketsBySp list expired bucket by sp

func (*MetadataModular) GfSpListGlobalVirtualGroupsByBucket added in v0.2.3

GfSpListGlobalVirtualGroupsByBucket list global virtual group by bucket id

func (*MetadataModular) GfSpListGlobalVirtualGroupsBySecondarySP added in v0.2.3

GfSpListGlobalVirtualGroupsBySecondarySP list global virtual group by secondary sp id

func (*MetadataModular) GfSpListGroupsByIDs added in v0.2.5

GfSpListGroupsByIDs list groups by group ids

func (*MetadataModular) GfSpListMigrateBucketEvents added in v0.2.3

GfSpListMigrateBucketEvents list migrate bucket events

func (*MetadataModular) GfSpListObjectPolicies added in v0.2.5

GfSpListObjectPolicies list policies by object info

func (*MetadataModular) GfSpListObjectsByBucketName

GfSpListObjectsByBucketName list objects info by a bucket name

func (*MetadataModular) GfSpListObjectsByGVGAndBucketForGC added in v0.2.3

GfSpListObjectsByGVGAndBucketForGC list objects by gvg and bucket for gc

func (*MetadataModular) GfSpListObjectsByIDs added in v0.2.4

GfSpListObjectsByIDs list objects by object ids

func (*MetadataModular) GfSpListObjectsInGVG added in v0.2.3

GfSpListObjectsInGVG list objects by gvg and bucket id

func (*MetadataModular) GfSpListObjectsInGVGAndBucket added in v0.2.3

GfSpListObjectsInGVGAndBucket list objects by gvg and bucket id

func (*MetadataModular) GfSpListPaymentAccountStreams added in v0.2.5

GfSpListPaymentAccountStreams list payment account streams

func (*MetadataModular) GfSpListSpExitEvents added in v0.2.3

GfSpListSpExitEvents list migrate sp exit events

func (*MetadataModular) GfSpListSwapOutEvents added in v0.2.3

GfSpListSwapOutEvents list swap out events

func (*MetadataModular) GfSpListUserPaymentAccounts added in v0.2.5

GfSpListUserPaymentAccounts list payment accounts by owner address

func (*MetadataModular) GfSpListVirtualGroupFamiliesBySpID added in v0.2.3

GfSpListVirtualGroupFamiliesBySpID list virtual group families by sp id

func (*MetadataModular) GfSpQueryResumableUploadSegment added in v0.2.3

func (*MetadataModular) GfSpVerifyPermission

GfSpVerifyPermission Verify the input account’s permission to input items

func (*MetadataModular) GfSpVerifyPermissionByID added in v0.2.3

GfSpVerifyPermissionByID Verify the input account’s permission to input source type and resource id

func (*MetadataModular) Name

func (r *MetadataModular) Name() string

func (*MetadataModular) ReleaseResource

func (r *MetadataModular) ReleaseResource(ctx context.Context, span rcmgr.ResourceScopeSpan)

func (*MetadataModular) ReserveResource

func (r *MetadataModular) ReserveResource(ctx context.Context, state *rcmgr.ScopeStat) (rcmgr.ResourceScopeSpan, error)

func (*MetadataModular) Start

func (r *MetadataModular) Start(ctx context.Context) error

func (*MetadataModular) Stop

func (r *MetadataModular) Stop(ctx context.Context) error

func (*MetadataModular) VerifyBucketPermission

func (r *MetadataModular) VerifyBucketPermission(ctx context.Context, bucketInfo *bsdb.Bucket, operator sdk.AccAddress,
	action permtypes.ActionType, options *permtypes.VerifyOptions) (permtypes.Effect, error)

VerifyBucketPermission verify bucket permission

func (*MetadataModular) VerifyGroupPermission added in v0.2.3

func (r *MetadataModular) VerifyGroupPermission(ctx context.Context, groupInfo *bsdb.Group, operator sdk.AccAddress,
	action permtypes.ActionType) (permtypes.Effect, error)

VerifyGroupPermission verify group permission

func (*MetadataModular) VerifyObjectPermission

func (r *MetadataModular) VerifyObjectPermission(ctx context.Context, bucketInfo *bsdb.Bucket, objectInfo *bsdb.Object,
	operator sdk.AccAddress, action permtypes.ActionType) (permtypes.Effect, error)

VerifyObjectPermission verify object permission

func (*MetadataModular) VerifyPolicy

func (r *MetadataModular) VerifyPolicy(ctx context.Context, resourceID math.Uint, resourceType resource.ResourceType,
	operator sdk.AccAddress, action permtypes.ActionType, opts *permtypes.VerifyOptions) (permtypes.Effect, error)

VerifyPolicy verify policy of permission

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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