server

package
v0.0.0-...-8e3b783 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrParamInvalid = errors.New("error param invalid")
	ErrParamNotSet  = errors.New("error param not set")
	ErrQueryFailed  = errors.New("error query failed")
	ErrUIDInvalid   = errors.New("error uid invalid")
	ErrTokenInvalid = errors.New("error token invalid")
	ErrUnknown      = errors.New("error unknown")
)

Functions

func OpenapiV1AuthRegisterPost

func OpenapiV1AuthRegisterPost(c *gin.Context)

OpenapiV1AuthRegisterPost TODO

func OpenapiV1AuthTokenGet

func OpenapiV1AuthTokenGet(c *gin.Context)

OpenapiV1AuthTokenGet 目前暂时用这个

func OpenapiV1AuthTokenPost

func OpenapiV1AuthTokenPost(c *gin.Context)

OpenapiV1AuthTokenPost TODO

func OpenapiV1BestStateGet

func OpenapiV1BestStateGet(c *gin.Context)

OpenapiV1BestStateGet - BestState

func OpenapiV1EventOrphanGet

func OpenapiV1EventOrphanGet(c *gin.Context)

OpenapiV1EventOrphanGet - Event_Orphan

func OpenapiV1Index

func OpenapiV1Index(c *gin.Context)

OpenapiV1Index is the index handler.

func OpenapiV1PeerGet

func OpenapiV1PeerGet(c *gin.Context)

OpenapiV1PeerGet - Peer

func OpenapiV1RevisionGet

func OpenapiV1RevisionGet(c *gin.Context)

OpenapiV1RevisionGet - Revision

func OpenapiV1SnapshotGet

func OpenapiV1SnapshotGet(c *gin.Context)

OpenapiV1SnapshotGet - Snapshot

func OpenapiV1TimelineGet

func OpenapiV1TimelineGet(c *gin.Context)

OpenapiV1TimelineGet - Timeline

func QueryBestStateBySID

func QueryBestStateBySID(peerTag string, snapshotID string, snapshotType int) ([]model.BestState, error)

func QueryEventOrphanByBHA

func QueryEventOrphanByBHA(peerTag string, blockHash string) ([]model.EventOrphan, error)

func QueryEventOrphanByPBHA

func QueryEventOrphanByPBHA(peerTag string, parentBlockHash string) ([]model.EventOrphan, error)

func QueryEventOrphanBySID

func QueryEventOrphanBySID(peerTag string, snapshotID string, eventOrphanType int) ([]model.EventOrphan, error)

func QueryPeer

func QueryPeer() ([]string, error)

func QueryRevisionBySID

func QueryRevisionBySID(peerTag string, snapshotID string, revisionType int, initTimestamp string) ([]model.Revision, error)

func QuerySnapshotByBHA

func QuerySnapshotByBHA(peerTag string, blockHash string, pageSize, pageNumber int) ([]model.Snapshot, error)

func QuerySnapshotByCIN

func QuerySnapshotByCIN(peerTag string, targetChainID int, targetChainHeight int32, pageSize, pageNumber int) ([]model.Snapshot, error)

func QuerySnapshotBySID

func QuerySnapshotBySID(peerTag string, snapshotID string, pageSize, pageNumber int) ([]model.Snapshot, error)

func QuerySnapshotByTRA

func QuerySnapshotByTRA(peerTag string, leftTimestamp, rightTimestamp string, pageSize, pageNumber int) ([]model.Snapshot, error)

func RunOpenAPIServer

func RunOpenAPIServer(addr string) error

Types

type IndexType

type IndexType string
const (
	IndexTypeBySID  IndexType = "by_snapshot_id"
	IndexTypeByTRA  IndexType = "by_timestamp_range"
	IndexTypeByBHA  IndexType = "by_block_hash"
	IndexTypeByCIN  IndexType = "by_chain_info"
	IndexTypeByPBHA IndexType = "by_parent_block_hash"
)

type OpenAPIServer

type OpenAPIServer struct {
	*gin.Engine
	// contains filtered or unexported fields
}

func InitOpenAPIServer

func InitOpenAPIServer(dbConf config.DatabaseConfig) *OpenAPIServer

InitOpenAPIServer init and returns the openapi server.

func (*OpenAPIServer) Raw

func (s *OpenAPIServer) Raw(sql string) (*gorm.DB, error)

type Route

type Route struct {
	// Name is the name of this Route.
	Name string
	// Method is the string for the HTTP method. ex) GET, POST etc..
	Method string
	// Pattern is the pattern of the URI.
	Pattern string
	// HandlerFunc is the handler function of this route.
	HandlerFunc gin.HandlerFunc
}

Route is the information for every URI.

type Routes

type Routes []Route

Routes is the list of the generated Route.

type Token

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

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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