metadata

package
v0.2.2-test.16 Latest Latest
Warning

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

Go to latest
Published: Jun 15, 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 (
	MetadataModularName        = strings.ToLower("Metadata")
	MetadataModularDescription = "Retrieves sp metadata and info."
)
View Source
var (
	ErrDanglingPointer = gfsperrors.Register(MetadataModularName, http.StatusBadRequest, 90001, "OoooH... request lost, try again later")
	ErrExceedRequest   = gfsperrors.Register(MetadataModularName, http.StatusNotAcceptable, 90002, "request exceed")
	ErrNoRecord        = gfsperrors.Register(MetadataModularName, http.StatusNotFound, 90003, "no uploading record")
	ErrGfSpDB          = gfsperrors.Register(MetadataModularName, http.StatusInternalServerError, 95202, "server slipped away, try again later")
)
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")
	// 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 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) GfSpGetEndpointBySpAddress

GfSpGetEndpointBySpAddress get endpoint by sp address

func (*MetadataModular) GfSpGetGroupList

GfSpGetGroupList get group list by queryName/prefix/sourceType

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) 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) GfSpListBucketsByBucketID

GfSpListBucketsByBucketID 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) GfSpListObjectsByBucketName

GfSpListObjectsByBucketName list objects info by a bucket name

func (*MetadataModular) GfSpListObjectsByObjectID

GfSpListObjectsByObjectID list objects by object ids

func (*MetadataModular) GfSpVerifyPermission

GfSpVerifyPermission Verify the input account’s permission to input items

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

Jump to

Keyboard shortcuts

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