types

package
v4.0.0-...-2fe2eb3 Latest Latest
Warning

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

Go to latest
Published: Jun 1, 2022 License: Apache-2.0 Imports: 29 Imported by: 0

Documentation

Overview

Package types is a reverse proxy.

It translates gRPC into RESTful JSON APIs.

Index

Constants

View Source
const (
	EventTypeEpochEnd   = "epoch_end"
	EventTypeEpochStart = "epoch_start"

	AttributeEpochNumber    = "epoch_number"
	AttributeEpochStartTime = "start_time"
)

epochs events

View Source
const (
	// WeekEpochID defines the identifier for weekly epochs
	WeekEpochID = "week"
	// DayEpochID defines the identifier for daily epochs
	DayEpochID = "day"
	// HourEpochID defines the identifier for hourly epochs
	HourEpochID = "hour"
)
View Source
const (
	// ModuleName defines the module name
	ModuleName = "epochs"

	// StoreKey defines the primary module store key
	StoreKey = ModuleName

	// RouterKey is the message route for epochs
	RouterKey = ModuleName
)

Variables

View Source
var (
	ErrInvalidLengthGenesis        = fmt.Errorf("proto: negative length found during unmarshaling")
	ErrIntOverflowGenesis          = fmt.Errorf("proto: integer overflow")
	ErrUnexpectedEndOfGroupGenesis = fmt.Errorf("proto: unexpected end of group")
)
View Source
var (
	ErrInvalidLengthQuery        = fmt.Errorf("proto: negative length found during unmarshaling")
	ErrIntOverflowQuery          = fmt.Errorf("proto: integer overflow")
	ErrUnexpectedEndOfGroupQuery = fmt.Errorf("proto: unexpected end of group")
)
View Source
var KeyPrefixEpoch = []byte{prefixEpoch}

KeyPrefixEpoch defines prefix key for storing epochs

Functions

func RegisterQueryHandler

func RegisterQueryHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error

RegisterQueryHandler registers the http handlers for service Query to "mux". The handlers forward requests to the grpc endpoint over "conn".

func RegisterQueryHandlerClient

func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, client QueryClient) error

RegisterQueryHandlerClient registers the http handlers for service Query to "mux". The handlers forward requests to the grpc endpoint over the given implementation of "QueryClient". Note: the gRPC framework executes interceptors within the gRPC handler. If the passed in "QueryClient" doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in "QueryClient" to call the correct interceptors.

func RegisterQueryHandlerFromEndpoint

func RegisterQueryHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error)

RegisterQueryHandlerFromEndpoint is same as RegisterQueryHandler but automatically dials to "endpoint" and closes the connection when "ctx" gets done.

func RegisterQueryHandlerServer

func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, server QueryServer) error

RegisterQueryHandlerServer registers the http handlers for service Query to "mux". UnaryRPC :call QueryServer directly. StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906. Note that using this registration option will cause many gRPC library features to stop working. Consider using RegisterQueryHandlerFromEndpoint instead.

func RegisterQueryServer

func RegisterQueryServer(s grpc1.Server, srv QueryServer)

func ValidateEpochIdentifierInterface

func ValidateEpochIdentifierInterface(i interface{}) error

ValidateEpochIdentifierInterface performs a stateless validation of the epoch ID interface.

func ValidateEpochIdentifierString

func ValidateEpochIdentifierString(s string) error

ValidateEpochIdentifierInterface performs a stateless validation of the epoch ID.

Types

type EpochHooks

type EpochHooks interface {
	// the first block whose timestamp is after the duration is counted as the end of the epoch
	AfterEpochEnd(ctx sdk.Context, epochIdentifier string, epochNumber int64)
	// new epoch is next block of epoch end block
	BeforeEpochStart(ctx sdk.Context, epochIdentifier string, epochNumber int64)
}

EpochHooks event hooks for epoch processing

type EpochInfo

type EpochInfo struct {
	Identifier              string        `protobuf:"bytes,1,opt,name=identifier,proto3" json:"identifier,omitempty"`
	StartTime               time.Time     `protobuf:"bytes,2,opt,name=start_time,json=startTime,proto3,stdtime" json:"start_time" yaml:"start_time"`
	Duration                time.Duration `protobuf:"bytes,3,opt,name=duration,proto3,stdduration" json:"duration,omitempty" yaml:"duration"`
	CurrentEpoch            int64         `protobuf:"varint,4,opt,name=current_epoch,json=currentEpoch,proto3" json:"current_epoch,omitempty"`
	CurrentEpochStartTime   time.Time     `` /* 158-byte string literal not displayed */
	EpochCountingStarted    bool          `protobuf:"varint,6,opt,name=epoch_counting_started,json=epochCountingStarted,proto3" json:"epoch_counting_started,omitempty"`
	CurrentEpochStartHeight int64         `` /* 135-byte string literal not displayed */
}

func (*EpochInfo) Descriptor

func (*EpochInfo) Descriptor() ([]byte, []int)

func (*EpochInfo) EndEpoch

func (ei *EpochInfo) EndEpoch()

EndEpoch increments the epoch counter and resets the epoch start time

func (*EpochInfo) GetCurrentEpoch

func (m *EpochInfo) GetCurrentEpoch() int64

func (*EpochInfo) GetCurrentEpochStartHeight

func (m *EpochInfo) GetCurrentEpochStartHeight() int64

func (*EpochInfo) GetCurrentEpochStartTime

func (m *EpochInfo) GetCurrentEpochStartTime() time.Time

func (*EpochInfo) GetDuration

func (m *EpochInfo) GetDuration() time.Duration

func (*EpochInfo) GetEpochCountingStarted

func (m *EpochInfo) GetEpochCountingStarted() bool

func (*EpochInfo) GetIdentifier

func (m *EpochInfo) GetIdentifier() string

func (*EpochInfo) GetStartTime

func (m *EpochInfo) GetStartTime() time.Time

func (*EpochInfo) Marshal

func (m *EpochInfo) Marshal() (dAtA []byte, err error)

func (*EpochInfo) MarshalTo

func (m *EpochInfo) MarshalTo(dAtA []byte) (int, error)

func (*EpochInfo) MarshalToSizedBuffer

func (m *EpochInfo) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*EpochInfo) ProtoMessage

func (*EpochInfo) ProtoMessage()

func (*EpochInfo) Reset

func (m *EpochInfo) Reset()

func (*EpochInfo) Size

func (m *EpochInfo) Size() (n int)

func (*EpochInfo) StartInitialEpoch

func (ei *EpochInfo) StartInitialEpoch()

StartInitialEpoch sets the epoch info fields to their start values

func (*EpochInfo) String

func (m *EpochInfo) String() string

func (*EpochInfo) Unmarshal

func (m *EpochInfo) Unmarshal(dAtA []byte) error

func (EpochInfo) Validate

func (ei EpochInfo) Validate() error

Validate performs a stateless validation of the epoch info fields

func (*EpochInfo) XXX_DiscardUnknown

func (m *EpochInfo) XXX_DiscardUnknown()

func (*EpochInfo) XXX_Marshal

func (m *EpochInfo) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*EpochInfo) XXX_Merge

func (m *EpochInfo) XXX_Merge(src proto.Message)

func (*EpochInfo) XXX_Size

func (m *EpochInfo) XXX_Size() int

func (*EpochInfo) XXX_Unmarshal

func (m *EpochInfo) XXX_Unmarshal(b []byte) error

type GenesisState

type GenesisState struct {
	Epochs []EpochInfo `protobuf:"bytes,1,rep,name=epochs,proto3" json:"epochs"`
}

GenesisState defines the epochs module's genesis state.

func DefaultGenesisState

func DefaultGenesisState() *GenesisState

DefaultGenesisState returns the default epochs genesis state

func NewGenesisState

func NewGenesisState(epochs []EpochInfo) *GenesisState

NewGenesisState creates a new genesis state instance

func (*GenesisState) Descriptor

func (*GenesisState) Descriptor() ([]byte, []int)

func (*GenesisState) GetEpochs

func (m *GenesisState) GetEpochs() []EpochInfo

func (*GenesisState) Marshal

func (m *GenesisState) Marshal() (dAtA []byte, err error)

func (*GenesisState) MarshalTo

func (m *GenesisState) MarshalTo(dAtA []byte) (int, error)

func (*GenesisState) MarshalToSizedBuffer

func (m *GenesisState) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*GenesisState) ProtoMessage

func (*GenesisState) ProtoMessage()

func (*GenesisState) Reset

func (m *GenesisState) Reset()

func (*GenesisState) Size

func (m *GenesisState) Size() (n int)

func (*GenesisState) String

func (m *GenesisState) String() string

func (*GenesisState) Unmarshal

func (m *GenesisState) Unmarshal(dAtA []byte) error

func (GenesisState) Validate

func (gs GenesisState) Validate() error

Validate performs basic genesis state validation returning an error upon any failure.

func (*GenesisState) XXX_DiscardUnknown

func (m *GenesisState) XXX_DiscardUnknown()

func (*GenesisState) XXX_Marshal

func (m *GenesisState) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*GenesisState) XXX_Merge

func (m *GenesisState) XXX_Merge(src proto.Message)

func (*GenesisState) XXX_Size

func (m *GenesisState) XXX_Size() int

func (*GenesisState) XXX_Unmarshal

func (m *GenesisState) XXX_Unmarshal(b []byte) error

type QueryClient

type QueryClient interface {
	// EpochInfos provide running epochInfos
	EpochInfos(ctx context.Context, in *QueryEpochsInfoRequest, opts ...grpc.CallOption) (*QueryEpochsInfoResponse, error)
	// CurrentEpoch provide current epoch of specified identifier
	CurrentEpoch(ctx context.Context, in *QueryCurrentEpochRequest, opts ...grpc.CallOption) (*QueryCurrentEpochResponse, error)
}

QueryClient is the client API for Query service.

For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream.

func NewQueryClient

func NewQueryClient(cc grpc1.ClientConn) QueryClient

type QueryCurrentEpochRequest

type QueryCurrentEpochRequest struct {
	Identifier string `protobuf:"bytes,1,opt,name=identifier,proto3" json:"identifier,omitempty"`
}

func (*QueryCurrentEpochRequest) Descriptor

func (*QueryCurrentEpochRequest) Descriptor() ([]byte, []int)

func (*QueryCurrentEpochRequest) GetIdentifier

func (m *QueryCurrentEpochRequest) GetIdentifier() string

func (*QueryCurrentEpochRequest) Marshal

func (m *QueryCurrentEpochRequest) Marshal() (dAtA []byte, err error)

func (*QueryCurrentEpochRequest) MarshalTo

func (m *QueryCurrentEpochRequest) MarshalTo(dAtA []byte) (int, error)

func (*QueryCurrentEpochRequest) MarshalToSizedBuffer

func (m *QueryCurrentEpochRequest) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*QueryCurrentEpochRequest) ProtoMessage

func (*QueryCurrentEpochRequest) ProtoMessage()

func (*QueryCurrentEpochRequest) Reset

func (m *QueryCurrentEpochRequest) Reset()

func (*QueryCurrentEpochRequest) Size

func (m *QueryCurrentEpochRequest) Size() (n int)

func (*QueryCurrentEpochRequest) String

func (m *QueryCurrentEpochRequest) String() string

func (*QueryCurrentEpochRequest) Unmarshal

func (m *QueryCurrentEpochRequest) Unmarshal(dAtA []byte) error

func (*QueryCurrentEpochRequest) XXX_DiscardUnknown

func (m *QueryCurrentEpochRequest) XXX_DiscardUnknown()

func (*QueryCurrentEpochRequest) XXX_Marshal

func (m *QueryCurrentEpochRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*QueryCurrentEpochRequest) XXX_Merge

func (m *QueryCurrentEpochRequest) XXX_Merge(src proto.Message)

func (*QueryCurrentEpochRequest) XXX_Size

func (m *QueryCurrentEpochRequest) XXX_Size() int

func (*QueryCurrentEpochRequest) XXX_Unmarshal

func (m *QueryCurrentEpochRequest) XXX_Unmarshal(b []byte) error

type QueryCurrentEpochResponse

type QueryCurrentEpochResponse struct {
	CurrentEpoch int64 `protobuf:"varint,1,opt,name=current_epoch,json=currentEpoch,proto3" json:"current_epoch,omitempty"`
}

func (*QueryCurrentEpochResponse) Descriptor

func (*QueryCurrentEpochResponse) Descriptor() ([]byte, []int)

func (*QueryCurrentEpochResponse) GetCurrentEpoch

func (m *QueryCurrentEpochResponse) GetCurrentEpoch() int64

func (*QueryCurrentEpochResponse) Marshal

func (m *QueryCurrentEpochResponse) Marshal() (dAtA []byte, err error)

func (*QueryCurrentEpochResponse) MarshalTo

func (m *QueryCurrentEpochResponse) MarshalTo(dAtA []byte) (int, error)

func (*QueryCurrentEpochResponse) MarshalToSizedBuffer

func (m *QueryCurrentEpochResponse) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*QueryCurrentEpochResponse) ProtoMessage

func (*QueryCurrentEpochResponse) ProtoMessage()

func (*QueryCurrentEpochResponse) Reset

func (m *QueryCurrentEpochResponse) Reset()

func (*QueryCurrentEpochResponse) Size

func (m *QueryCurrentEpochResponse) Size() (n int)

func (*QueryCurrentEpochResponse) String

func (m *QueryCurrentEpochResponse) String() string

func (*QueryCurrentEpochResponse) Unmarshal

func (m *QueryCurrentEpochResponse) Unmarshal(dAtA []byte) error

func (*QueryCurrentEpochResponse) XXX_DiscardUnknown

func (m *QueryCurrentEpochResponse) XXX_DiscardUnknown()

func (*QueryCurrentEpochResponse) XXX_Marshal

func (m *QueryCurrentEpochResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*QueryCurrentEpochResponse) XXX_Merge

func (m *QueryCurrentEpochResponse) XXX_Merge(src proto.Message)

func (*QueryCurrentEpochResponse) XXX_Size

func (m *QueryCurrentEpochResponse) XXX_Size() int

func (*QueryCurrentEpochResponse) XXX_Unmarshal

func (m *QueryCurrentEpochResponse) XXX_Unmarshal(b []byte) error

type QueryEpochsInfoRequest

type QueryEpochsInfoRequest struct {
	Pagination *query.PageRequest `protobuf:"bytes,1,opt,name=pagination,proto3" json:"pagination,omitempty"`
}

func (*QueryEpochsInfoRequest) Descriptor

func (*QueryEpochsInfoRequest) Descriptor() ([]byte, []int)

func (*QueryEpochsInfoRequest) GetPagination

func (m *QueryEpochsInfoRequest) GetPagination() *query.PageRequest

func (*QueryEpochsInfoRequest) Marshal

func (m *QueryEpochsInfoRequest) Marshal() (dAtA []byte, err error)

func (*QueryEpochsInfoRequest) MarshalTo

func (m *QueryEpochsInfoRequest) MarshalTo(dAtA []byte) (int, error)

func (*QueryEpochsInfoRequest) MarshalToSizedBuffer

func (m *QueryEpochsInfoRequest) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*QueryEpochsInfoRequest) ProtoMessage

func (*QueryEpochsInfoRequest) ProtoMessage()

func (*QueryEpochsInfoRequest) Reset

func (m *QueryEpochsInfoRequest) Reset()

func (*QueryEpochsInfoRequest) Size

func (m *QueryEpochsInfoRequest) Size() (n int)

func (*QueryEpochsInfoRequest) String

func (m *QueryEpochsInfoRequest) String() string

func (*QueryEpochsInfoRequest) Unmarshal

func (m *QueryEpochsInfoRequest) Unmarshal(dAtA []byte) error

func (*QueryEpochsInfoRequest) XXX_DiscardUnknown

func (m *QueryEpochsInfoRequest) XXX_DiscardUnknown()

func (*QueryEpochsInfoRequest) XXX_Marshal

func (m *QueryEpochsInfoRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*QueryEpochsInfoRequest) XXX_Merge

func (m *QueryEpochsInfoRequest) XXX_Merge(src proto.Message)

func (*QueryEpochsInfoRequest) XXX_Size

func (m *QueryEpochsInfoRequest) XXX_Size() int

func (*QueryEpochsInfoRequest) XXX_Unmarshal

func (m *QueryEpochsInfoRequest) XXX_Unmarshal(b []byte) error

type QueryEpochsInfoResponse

type QueryEpochsInfoResponse struct {
	Epochs     []EpochInfo         `protobuf:"bytes,1,rep,name=epochs,proto3" json:"epochs"`
	Pagination *query.PageResponse `protobuf:"bytes,2,opt,name=pagination,proto3" json:"pagination,omitempty"`
}

func (*QueryEpochsInfoResponse) Descriptor

func (*QueryEpochsInfoResponse) Descriptor() ([]byte, []int)

func (*QueryEpochsInfoResponse) GetEpochs

func (m *QueryEpochsInfoResponse) GetEpochs() []EpochInfo

func (*QueryEpochsInfoResponse) GetPagination

func (m *QueryEpochsInfoResponse) GetPagination() *query.PageResponse

func (*QueryEpochsInfoResponse) Marshal

func (m *QueryEpochsInfoResponse) Marshal() (dAtA []byte, err error)

func (*QueryEpochsInfoResponse) MarshalTo

func (m *QueryEpochsInfoResponse) MarshalTo(dAtA []byte) (int, error)

func (*QueryEpochsInfoResponse) MarshalToSizedBuffer

func (m *QueryEpochsInfoResponse) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*QueryEpochsInfoResponse) ProtoMessage

func (*QueryEpochsInfoResponse) ProtoMessage()

func (*QueryEpochsInfoResponse) Reset

func (m *QueryEpochsInfoResponse) Reset()

func (*QueryEpochsInfoResponse) Size

func (m *QueryEpochsInfoResponse) Size() (n int)

func (*QueryEpochsInfoResponse) String

func (m *QueryEpochsInfoResponse) String() string

func (*QueryEpochsInfoResponse) Unmarshal

func (m *QueryEpochsInfoResponse) Unmarshal(dAtA []byte) error

func (*QueryEpochsInfoResponse) XXX_DiscardUnknown

func (m *QueryEpochsInfoResponse) XXX_DiscardUnknown()

func (*QueryEpochsInfoResponse) XXX_Marshal

func (m *QueryEpochsInfoResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*QueryEpochsInfoResponse) XXX_Merge

func (m *QueryEpochsInfoResponse) XXX_Merge(src proto.Message)

func (*QueryEpochsInfoResponse) XXX_Size

func (m *QueryEpochsInfoResponse) XXX_Size() int

func (*QueryEpochsInfoResponse) XXX_Unmarshal

func (m *QueryEpochsInfoResponse) XXX_Unmarshal(b []byte) error

type QueryServer

type QueryServer interface {
	// EpochInfos provide running epochInfos
	EpochInfos(context.Context, *QueryEpochsInfoRequest) (*QueryEpochsInfoResponse, error)
	// CurrentEpoch provide current epoch of specified identifier
	CurrentEpoch(context.Context, *QueryCurrentEpochRequest) (*QueryCurrentEpochResponse, error)
}

QueryServer is the server API for Query service.

type UnimplementedQueryServer

type UnimplementedQueryServer struct {
}

UnimplementedQueryServer can be embedded to have forward compatible implementations.

func (*UnimplementedQueryServer) CurrentEpoch

func (*UnimplementedQueryServer) EpochInfos

Jump to

Keyboard shortcuts

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