service_mgr

package
v1.28.1 Latest Latest
Warning

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

Go to latest
Published: Apr 11, 2023 License: Apache-2.0 Imports: 9 Imported by: 2

Documentation

Index

Constants

View Source
const (
	ServicePrefix           = "service"
	ServiceAppchainPrefix   = "appchain-service"
	ServiceTypePrefix       = "type-service"
	ServiceNamePrefix       = "name-service"
	ServiceOccupyNamePrefix = "occupy-service-name"
)

Variables

This section is empty.

Functions

func AppchainServicesKey

func AppchainServicesKey(id string) string

func ServiceKey

func ServiceKey(id string) string

func ServiceOccupyNameKey

func ServiceOccupyNameKey(name string) string

func ServicesNameKey

func ServicesNameKey(name string) string

func ServicesTypeKey

func ServicesTypeKey(typ string) string

Types

type Service

type Service struct {
	ChainID    string              `json:"chain_id"`    // aoochain id
	ServiceID  string              `json:"service_id"`  // service id, contract addr(ServiceCallContract), service name(others)
	Name       string              `json:"name"`        // service name
	Type       ServiceType         `json:"type"`        // service type
	Intro      string              `json:"intro"`       // service introduction
	Ordered    bool                `json:"ordered"`     // service should be in order or not
	Permission map[string]struct{} `json:"permission"`  // counter party services which are allowed to call the service
	PubKeyType string              `json:"pubkey_type"` // todo: the use of this field awaits further refinement
	Details    string              `json:"details"`     // Detailed description of the service
	CreateTime int64               `json:"create_time"` // service create time

	Score             float64                                 `json:"score"`
	EvaluationRecords map[string]*governance.EvaluationRecord `json:"evaluation_records"`

	InvokeCount       uint64                              `json:"invoke_count"`
	InvokeSuccessRate float64                             `json:"invoke_success_rate"`
	InvokeRecords     map[string]*governance.InvokeRecord `json:"transfer_records"`

	Status governance.GovernanceStatus `json:"status"`
	FSM    *fsm.FSM                    `json:"fsm"`
}

func (*Service) CheckPermission

func (s *Service) CheckPermission(serviceId string) bool

func (*Service) IsAvailable

func (s *Service) IsAvailable() bool

type ServiceManager

type ServiceManager struct {
	governance.Persister
}

func (*ServiceManager) All

func (sm *ServiceManager) All(_ []byte) (interface{}, error)

func (*ServiceManager) ChangeStatus

func (sm *ServiceManager) ChangeStatus(id, trigger, lastStatus string, _ []byte) (bool, []byte)

func (*ServiceManager) CountAll

func (sm *ServiceManager) CountAll(_ []byte) (bool, []byte)

func (*ServiceManager) CountAvailable

func (sm *ServiceManager) CountAvailable(_ []byte) (bool, []byte)

func (*ServiceManager) GetIDListByChainID

func (sm *ServiceManager) GetIDListByChainID(chainID string) ([]string, error)

func (*ServiceManager) GetIDListByType

func (sm *ServiceManager) GetIDListByType(typ string) ([]string, error)

func (*ServiceManager) GetServiceIDByName

func (sm *ServiceManager) GetServiceIDByName(name string) (string, error)

func (*ServiceManager) GovernancePre

func (sm *ServiceManager) GovernancePre(id string, event governance.EventType, _ []byte) (interface{}, *boltvm.BxhError)

func (*ServiceManager) PackageServiceInfo

func (sm *ServiceManager) PackageServiceInfo(chainID, serviceID, name, typ, intro string, ordered bool, permits, details string, createTime int64, status governance.GovernanceStatus) (*Service, error)

func (*ServiceManager) QueryById

func (sm *ServiceManager) QueryById(id string, _ []byte) (interface{}, error)

func (*ServiceManager) Register

func (sm *ServiceManager) Register(info *Service)

func (*ServiceManager) RegisterPre

func (sm *ServiceManager) RegisterPre(info *Service)

func (*ServiceManager) Update

func (sm *ServiceManager) Update(updateInfo *Service) (bool, []byte)

type ServiceMgr

type ServiceMgr interface {
	governance.Governance

	PackageServiceInfo(chainID, serviceID, name, typ, intro string, ordered bool, permits, details string, createTime int64, status governance.GovernanceStatus) (*Service, error)

	RegisterPre(info *Service)

	// Register registers object info, return object id and error
	Register(serviceInfo *Service)

	// Update updates available or frozen object
	Update(serviceInfo *Service) (bool, []byte)

	GetIDListByChainID(chainID string) ([]string, error)

	GetIDListByType(typ string) ([]string, error)

	GetServiceIDByName(name string) (string, error)
}

func New

func New(persister governance.Persister) ServiceMgr

type ServiceType

type ServiceType string
var (
	ServiceCallContract       ServiceType = "CallContract"
	ServiceDepositCertificate ServiceType = "DepositCertificate"
	ServiceDataMigration      ServiceType = "DataMigration"
)

Jump to

Keyboard shortcuts

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