Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var DasMethods = [...]string{
"getAsset",
"searchAssets",
"getAssetProof",
"getAssetsByGroup",
"getAssetsByOwner",
"getAssetsByCreator",
"getAssetsByAuthority",
}
Functions ¶
This section is empty.
Types ¶
type RPCRequest ¶
type RPCRequest struct { Method string `json:"method"` Params interface{} `json:"params,omitempty"` ID any `json:"id"` JSONRPC string `json:"jsonrpc"` }
func (*RPCRequest) IsDasRequest ¶
func (r *RPCRequest) IsDasRequest() bool
func (*RPCRequest) RequestType ¶
func (r *RPCRequest) RequestType() RPCRequestType
type RPCRequestType ¶
type RPCRequestType uint8
const ( RegularRPCRequest RPCRequestType = 1 DasRPCRequest RPCRequestType = 3 )
type RoundRobinBalancer ¶
type RoundRobinBalancer struct {
// contains filtered or unexported fields
}
Regular RoundRobin implementation
func NewRoundRobinBalancer ¶
func NewRoundRobinBalancer(servers []ServerEndpoint) (*RoundRobinBalancer, error)
func (*RoundRobinBalancer) NextServer ¶
func (b *RoundRobinBalancer) NextServer() *url.URL
type Route ¶
type Route struct { BalancerType string `json:"balancerType"` Servers []ServerEndpoint `json:"servers"` }
type RouterHandler ¶
type RouterHandler struct {
// contains filtered or unexported fields
}
func (*RouterHandler) NextServer ¶
func (h *RouterHandler) NextServer(rpcReq *RPCRequest) *url.URL
func (*RouterHandler) ServeHTTP ¶
func (h *RouterHandler) ServeHTTP(w http.ResponseWriter, r *http.Request)
type RpcRoutes ¶
type RpcRoutes map[RPCRequestType]Balancer
type ServerEndpoint ¶
func ConvertToEndpoint ¶
func ConvertToEndpoint(rawUrl string, weight uint64) (ServerEndpoint, error)
func MustConvertToEndpoint ¶
func MustConvertToEndpoint(rawUrl string, weight uint64) ServerEndpoint
func (*ServerEndpoint) UnmarshalJSON ¶
func (s *ServerEndpoint) UnmarshalJSON(data []byte) error
UnmarshalJSON implements the json.Unmarshaler interface to fix url.URL
type WeightedRoundRobinBalancer ¶
type WeightedRoundRobinBalancer struct {
// contains filtered or unexported fields
}
Weighted RoundRobin implementation
func NewWeightedRoundRobinBalancer ¶
func NewWeightedRoundRobinBalancer(servers []ServerEndpoint) (*WeightedRoundRobinBalancer, error)
func (*WeightedRoundRobinBalancer) NextServer ¶
func (b *WeightedRoundRobinBalancer) NextServer() *url.URL
Click to show internal directories.
Click to hide internal directories.