Documentation ¶
Index ¶
- Constants
- Variables
- func EqualsSyscallErrno(err error, sen syscall.Errno) bool
- func FileDownload(resp *http.Response) (b []byte, fileName string, err error)
- func GetFileMultipart(ctx echo.Context, fieldname string) ([]byte, error)
- func GetJsonMultipart(ctx echo.Context, ptr interface{}) error
- func MultipartCopy(mw *multipart.Writer, fieldName string, r io.Reader) error
- func MultipartFile(mw *multipart.Writer, fieldName, fileName string) error
- func MultipartJson(mw *multipart.Writer, fieldName string, v interface{}) error
- func NewRestError(r *http.Response) error
- func RegisterInspectFunc(name string, f InspectFunc) error
- func RegisterRest(n *Node)
- func ResolveAbsolute(baseFile, targetPath string) string
- func UrlWithParams(reqUrl string, reqParams ...*url.Values) string
- type Auth
- type BackupInfo
- type Chain
- type ChainConfig
- type ChainImportParam
- type ChainInspectView
- type ChainPruneParam
- type ChainView
- type ConfigureParam
- type InspectFunc
- type JsonTemplate
- type Node
- func (n *Node) BackupChain(cid int) (string, error)
- func (n *Node) CanAdd(cid, nid int, channel string, overwrite bool) error
- func (n *Node) Configure(key string, value string) error
- func (n *Node) ConfigureChain(cid int, key string, value string) error
- func (n *Node) GetBackups() ([]BackupInfo, error)
- func (n *Node) GetChain(cid int) *Chain
- func (n *Node) GetChainByChannel(channel string) *Chain
- func (n *Node) GetChainBySelector(s string) *Chain
- func (n *Node) GetChains() []*Chain
- func (n *Node) GetRestore() *RestoreView
- func (n *Node) ImportChain(cid int, s string, height int64) error
- func (n *Node) JoinChain(p *ChainConfig, genesis []byte) (module.Chain, error)
- func (n *Node) LeaveChain(cid int) error
- func (n *Node) PruneChain(cid int, dbt string, height int64) error
- func (n *Node) ResetChain(cid int) error
- func (n *Node) RunChainTask(cid int, task string, params json.RawMessage) error
- func (n *Node) Start()
- func (n *Node) StartChain(cid int) error
- func (n *Node) StartRestore(name string, overwrite bool) (ret error)
- func (n *Node) Stop()
- func (n *Node) StopChain(cid int) error
- func (n *Node) StopRestore() error
- func (n *Node) VerifyChain(cid int) error
- type Rest
- func (r *Rest) AddUser(ctx echo.Context) error
- func (r *Rest) BackupChain(ctx echo.Context) error
- func (r *Rest) ChainInjector(next echo.HandlerFunc) echo.HandlerFunc
- func (r *Rest) ConfigureChain(ctx echo.Context) error
- func (r *Rest) ConfigureSystem(ctx echo.Context) error
- func (r *Rest) GetBackups(ctx echo.Context) error
- func (r *Rest) GetChain(ctx echo.Context) error
- func (r *Rest) GetChainConfig(ctx echo.Context) error
- func (r *Rest) GetChainGenesis(ctx echo.Context) error
- func (r *Rest) GetChains(ctx echo.Context) error
- func (r *Rest) GetRestore(ctx echo.Context) error
- func (r *Rest) GetSystem(ctx echo.Context) error
- func (r *Rest) GetSystemConfig(ctx echo.Context) error
- func (r *Rest) ImportChain(ctx echo.Context) error
- func (r *Rest) JoinChain(ctx echo.Context) error
- func (r *Rest) LeaveChain(ctx echo.Context) error
- func (r *Rest) PruneChain(ctx echo.Context) error
- func (r *Rest) RegisterChainHandlers(g *echo.Group)
- func (r *Rest) RegisterStatsHandlers(g *echo.Group)
- func (r *Rest) RegisterSystemHandlers(g *echo.Group)
- func (r *Rest) RegisterUserHandlers(g *echo.Group)
- func (r *Rest) RegistryBackupHandlers(g *echo.Group)
- func (r *Rest) RegistryRestoreHandlers(g *echo.Group)
- func (r *Rest) RemoveUser(ctx echo.Context) error
- func (r *Rest) ResetChain(ctx echo.Context) error
- func (r *Rest) ResponseStatsView(resp *echo.Response) error
- func (r *Rest) RestoreBackup(ctx echo.Context) error
- func (r *Rest) RunChainTask(ctx echo.Context) error
- func (r *Rest) StartChain(ctx echo.Context) error
- func (r *Rest) StopChain(ctx echo.Context) error
- func (r *Rest) StopRestore(ctx echo.Context) error
- func (r *Rest) StreamStats(ctx echo.Context) error
- func (r *Rest) Users(ctx echo.Context) error
- func (r *Rest) VerifyChain(ctx echo.Context) error
- type RestError
- type RestoreBackupParam
- type RestoreManager
- type RestoreState
- type RestoreStatus
- type RestoreView
- type RuntimeConfig
- type StaticConfig
- type StatsView
- type StreamCallbackFunc
- type SystemView
- type UnixDomainSockHttpClient
- func (c *UnixDomainSockHttpClient) Delete(reqUrl string, respPtr interface{}) (resp *http.Response, err error)
- func (c *UnixDomainSockHttpClient) Do(method, reqUrl string, reqPtr, respPtr interface{}) (resp *http.Response, err error)
- func (c *UnixDomainSockHttpClient) Get(reqUrl string, respPtr interface{}, reqParams ...*url.Values) (resp *http.Response, err error)
- func (c *UnixDomainSockHttpClient) Post(reqUrl string, respPtr interface{}) (resp *http.Response, err error)
- func (c *UnixDomainSockHttpClient) PostWithFile(reqUrl string, reqPtr interface{}, fieldName, fileName string, ...) (resp *http.Response, err error)
- func (c *UnixDomainSockHttpClient) PostWithJson(reqUrl string, reqPtr interface{}, respPtr interface{}) (resp *http.Response, err error)
- func (c *UnixDomainSockHttpClient) PostWithReader(reqUrl string, reqPtr interface{}, fieldName string, r io.Reader, ...) (resp *http.Response, err error)
- func (c *UnixDomainSockHttpClient) Stream(reqUrl string, reqPtr, respPtr interface{}, respFunc StreamCallbackFunc, ...) (resp *http.Response, err error)
- type UnixDomainSockHttpServer
Constants ¶
View Source
const ( ChainConfigFileName = "config.json" ChainGenesisZipFileName = "genesis.zip" )
View Source
const ( UrlSystem = "/system" UrlUser = "/user" UrlStats = "/stats" UrlChain = "/chain" ParamCID = "cid" UrlChainRes = "/:" + ParamCID ParamID = "id" UrlUserRes = "/:" + ParamID TaskID = "task" )
View Source
const (
AuthScheme = "goloop"
)
View Source
const (
BaseUnixDomainSockHttpEndpoint = "http://localhost"
)
View Source
const (
DefaultEEInstances = 1
)
View Source
const (
RestoreDirectoryPrefix = ".restore"
)
Variables ¶
View Source
var ( ErrAlreadyExists = errors.New("already exists") ErrNotExists = errors.New("not exists") )
Functions ¶
func GetFileMultipart ¶
func GetJsonMultipart ¶
func GetJsonMultipart(ctx echo.Context, ptr interface{}) error
func MultipartJson ¶
func NewRestError ¶
func RegisterInspectFunc ¶
func RegisterInspectFunc(name string, f InspectFunc) error
func RegisterRest ¶
func RegisterRest(n *Node)
func ResolveAbsolute ¶
Types ¶
type Auth ¶
type Auth struct { SkipIfEmptyUsers bool // contains filtered or unexported fields }
func (*Auth) IsEmptyUsers ¶
func (*Auth) MiddlewareFunc ¶
func (a *Auth) MiddlewareFunc() echo.MiddlewareFunc
func (*Auth) RemoveUser ¶
type BackupInfo ¶
type BackupInfo struct { Name string `json:"name"` Size int64 `json:"size"` chain.BackupInfo }
type ChainConfig ¶
type ChainConfig struct { DBType string `json:"dbType"` Platform string `json:"platform"` SeedAddr string `json:"seedAddress"` Role uint `json:"role"` ConcurrencyLevel int `json:"concurrencyLevel,omitempty"` NormalTxPoolSize int `json:"normalTxPool,omitempty"` PatchTxPoolSize int `json:"patchTxPool,omitempty"` MaxBlockTxBytes int `json:"maxBlockTxBytes,omitempty"` NodeCache string `json:"nodeCache,omitempty"` Channel string `json:"channel"` SecureSuites string `json:"secureSuites"` SecureAeads string `json:"secureAeads"` DefWaitTimeout int64 `json:"defaultWaitTimeout"` MaxWaitTimeout int64 `json:"maxWaitTimeout"` TxTimeout int64 `json:"txTimeout"` AutoStart bool `json:"autoStart"` ChildrenLimit *int `json:"childrenLimit,omitempty"` NephewsLimit *int `json:"nephewsLimit,omitempty"` }
func NewChainConfig ¶
func NewChainConfig(cfg *chain.Config) *ChainConfig
type ChainImportParam ¶
type ChainInspectView ¶
type ChainInspectView struct { *ChainView GenesisTx json.RawMessage `json:"genesisTx"` Config *ChainConfig `json:"config"` // TODO [TBD] define structure each module for inspect Module map[string]interface{} `json:"module"` }
func NewChainInspectView ¶
func NewChainInspectView(c *Chain) *ChainInspectView
type ChainPruneParam ¶
type ChainView ¶
type ChainView struct { CID common.HexInt32 `json:"cid"` NID common.HexInt32 `json:"nid"` Channel string `json:"channel"` State string `json:"state"` Height int64 `json:"height"` LastError string `json:"lastError"` }
func NewChainView ¶
type ConfigureParam ¶
type JsonTemplate ¶
func NewJsonTemplate ¶
func NewJsonTemplate(name string) *JsonTemplate
func (*JsonTemplate) Response ¶
func (t *JsonTemplate) Response(format string, v interface{}, resp *echo.Response) error
type Node ¶
type Node struct {
// contains filtered or unexported fields
}
func (*Node) ConfigureChain ¶
func (*Node) GetBackups ¶
func (n *Node) GetBackups() ([]BackupInfo, error)
func (*Node) GetChainByChannel ¶
func (*Node) GetChainBySelector ¶
func (*Node) GetRestore ¶
func (n *Node) GetRestore() *RestoreView
GetRestore returns state of latest restore operations.
func (*Node) LeaveChain ¶
func (*Node) ResetChain ¶
func (*Node) RunChainTask ¶ added in v0.9.6
func (*Node) StartChain ¶
func (*Node) StartRestore ¶
StartRestore start to restore chain.
func (*Node) StopRestore ¶
StopRestore stops last restore operation. If there is no ongoing restore,then it clears already finished job.
func (*Node) VerifyChain ¶
type Rest ¶
type Rest struct {
// contains filtered or unexported fields
}
func (*Rest) BackupChain ¶
func (*Rest) ChainInjector ¶
func (r *Rest) ChainInjector(next echo.HandlerFunc) echo.HandlerFunc
func (*Rest) ConfigureChain ¶
func (*Rest) ConfigureSystem ¶
func (*Rest) GetBackups ¶
func (*Rest) GetChainConfig ¶
func (*Rest) GetChainGenesis ¶
func (*Rest) GetRestore ¶
func (*Rest) GetSystemConfig ¶
func (*Rest) ImportChain ¶
func (*Rest) LeaveChain ¶
func (*Rest) PruneChain ¶
func (*Rest) RegisterChainHandlers ¶
func (r *Rest) RegisterChainHandlers(g *echo.Group)
func (*Rest) RegisterStatsHandlers ¶
func (r *Rest) RegisterStatsHandlers(g *echo.Group)
func (*Rest) RegisterSystemHandlers ¶
func (r *Rest) RegisterSystemHandlers(g *echo.Group)
func (*Rest) RegisterUserHandlers ¶
func (r *Rest) RegisterUserHandlers(g *echo.Group)
func (*Rest) RegistryBackupHandlers ¶
func (r *Rest) RegistryBackupHandlers(g *echo.Group)
func (*Rest) RegistryRestoreHandlers ¶
func (r *Rest) RegistryRestoreHandlers(g *echo.Group)
func (*Rest) RemoveUser ¶
func (*Rest) ResetChain ¶
func (*Rest) ResponseStatsView ¶
func (*Rest) RestoreBackup ¶
func (*Rest) RunChainTask ¶ added in v0.9.6
func (*Rest) StartChain ¶
func (*Rest) StopRestore ¶
func (*Rest) StreamStats ¶
func (*Rest) VerifyChain ¶
type RestError ¶
type RestError struct {
// contains filtered or unexported fields
}
func (*RestError) StatusCode ¶
type RestoreBackupParam ¶
type RestoreManager ¶
type RestoreManager struct {
// contains filtered or unexported fields
}
func (*RestoreManager) GetStatus ¶
func (m *RestoreManager) GetStatus() *RestoreStatus
func (*RestoreManager) Stop ¶
func (m *RestoreManager) Stop() error
type RestoreState ¶
type RestoreState int
const ( RestoreNone RestoreState = iota RestoreStarted RestoreFailed RestoreSuccess RestoreStopping )
func (RestoreState) String ¶
func (s RestoreState) String() string
type RestoreStatus ¶
type RestoreView ¶
type RuntimeConfig ¶
type StaticConfig ¶
type StaticConfig struct { // static CliSocket string `json:"node_sock"` // relative path P2PAddr string `json:"p2p"` P2PListenAddr string `json:"p2p_listen"` RPCAddr string `json:"rpc_addr"` RPCDump bool `json:"rpc_dump"` EESocket string `json:"ee_socket"` Engines string `json:"engines"` BackupDir string `json:"backup_dir"` AuthSkipIfEmptyUsers bool `json:"auth_skip_if_empty_users,omitempty"` NIDForP2P bool `json:"nid_for_p2p,omitempty"` BaseDir string `json:"node_dir"` FilePath string `json:"-"` // absolute path // build info BuildVersion string `json:"-"` BuildTags string `json:"-"` }
func (*StaticConfig) AbsBaseDir ¶
func (c *StaticConfig) AbsBaseDir() string
func (*StaticConfig) FillEmpty ¶
func (c *StaticConfig) FillEmpty(addr module.Address)
func (*StaticConfig) ResolveAbsolute ¶
func (c *StaticConfig) ResolveAbsolute(targetPath string) string
func (*StaticConfig) ResolveRelative ¶
func (c *StaticConfig) ResolveRelative(targetPath string) string
func (*StaticConfig) SetFilePath ¶
func (c *StaticConfig) SetFilePath(path string) string
type StreamCallbackFunc ¶
type StreamCallbackFunc func(respPtr interface{}) error
type SystemView ¶
type SystemView struct { BuildVersion string `json:"buildVersion"` BuildTags string `json:"buildTags"` Setting struct { Address string `json:"address"` P2PAddr string `json:"p2p"` P2PListenAddr string `json:"p2pListen"` RPCAddr string `json:"rpcAddr"` RPCDump bool `json:"rpcDump"` } `json:"setting"` Config interface{} `json:"config"` }
type UnixDomainSockHttpClient ¶
type UnixDomainSockHttpClient struct {
// contains filtered or unexported fields
}
func NewUnixDomainSockHttpClient ¶
func NewUnixDomainSockHttpClient(sockPath string) *UnixDomainSockHttpClient
func (*UnixDomainSockHttpClient) Delete ¶
func (c *UnixDomainSockHttpClient) Delete(reqUrl string, respPtr interface{}) (resp *http.Response, err error)
func (*UnixDomainSockHttpClient) Do ¶
func (c *UnixDomainSockHttpClient) Do(method, reqUrl string, reqPtr, respPtr interface{}) (resp *http.Response, err error)
func (*UnixDomainSockHttpClient) Post ¶
func (c *UnixDomainSockHttpClient) Post(reqUrl string, respPtr interface{}) (resp *http.Response, err error)
func (*UnixDomainSockHttpClient) PostWithFile ¶
func (*UnixDomainSockHttpClient) PostWithJson ¶
func (c *UnixDomainSockHttpClient) PostWithJson(reqUrl string, reqPtr interface{}, respPtr interface{}) (resp *http.Response, err error)
func (*UnixDomainSockHttpClient) PostWithReader ¶
type UnixDomainSockHttpServer ¶
type UnixDomainSockHttpServer struct {
// contains filtered or unexported fields
}
func NewUnixDomainSockHttpServer ¶
func NewUnixDomainSockHttpServer(sockPath string, e *echo.Echo) *UnixDomainSockHttpServer
func (*UnixDomainSockHttpServer) Start ¶
func (s *UnixDomainSockHttpServer) Start() error
func (*UnixDomainSockHttpServer) Stop ¶
func (s *UnixDomainSockHttpServer) Stop() error
Click to show internal directories.
Click to hide internal directories.