service

package
v0.0.0-...-fdc5c16 Latest Latest
Warning

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

Go to latest
Published: Jul 13, 2022 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ApiParameterType = struct {
	XML     enum.Element
	JSON    enum.Element
	URL     enum.Element
	Binary  enum.Element
	Private enum.Element
}{}
View Source
var ApiProtocolMethod = struct {
	HttpGet      enum.Element
	HttpPost     enum.Element
	Binary       enum.Element
	InternalCall enum.Element
}{}
View Source
var ApiProtocols = struct {
	HTTP     enum.Element
	TCP      enum.Element
	UDP      enum.Element
	INTERNAL enum.Element
}{}

Functions

func Load

func Load()

Types

type ApiDescription

type ApiDescription struct {
	Protocol string
	Address  string
	ApiList  []ApiInterface
}

type ApiInterface

type ApiInterface struct {
	Description string
	Path        string
	Method      string
	Parameters  Parameters
}

type BasicInformation

type BasicInformation struct {
	Name        string
	Description string
	Settings    interface{}
	Api         ApiDescription
	SubServices []BasicInformation
}

type BlankService

type BlankService struct{}

a blank service to simplify the creation of new services

func (BlankService) Cancel

func (b BlankService) Cancel(req interface{}) (err error)

func (BlankService) Execute

func (b BlankService) Execute(req interface{}) (result []byte, err error)

func (BlankService) Information

func (b BlankService) Information() (info BasicInformation)

func (BlankService) Name

func (b BlankService) Name() (name string)

func (BlankService) PreExecute

func (b BlankService) PreExecute(req interface{}) (result []byte, err error)

func (BlankService) PushClientRequest

func (b BlankService) PushClientRequest(req interface{}) (result string, err error)

func (BlankService) RequestsForConsensus

func (b BlankService) RequestsForConsensus(lastReqs []interface{}) (req [][]byte, cnt uint32)

type IService

type IService interface {
	//service name, this is the ID that registered to engine
	Name() (name string)

	//build request list for consensus network, engine will call this method when you are a consensus leader
	RequestsForConsensus(lastReqs []interface{}) (req [][]byte, cnt uint32)

	//receive and verify request from consensus network (on the other word, this request comes from consensus leader)
	PreExecute(req interface{}) (result []byte, err error)

	//receive and execute confirmed request of this round of consensus
	Execute(req interface{}) (result []byte, err error)

	//handle consensus failed
	Cancel(req interface{}) (err error)

	//service information
	Information() (info BasicInformation)
}

type Parameters

type Parameters http.Parameters

Jump to

Keyboard shortcuts

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