Skip to content

Commit

Permalink
rename obs -> clb
Browse files Browse the repository at this point in the history
  • Loading branch information
scottafk committed Dec 23, 2021
1 parent c5e5baa commit 6111008
Show file tree
Hide file tree
Showing 58 changed files with 372 additions and 371 deletions.
2 changes: 1 addition & 1 deletion cmd/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ func init() {
cmdFlags.Int64Var(&conf.Config.LocalConf.MaxPageGenerationTime, "mpgt", 3000, "Max page generation time in ms")
cmdFlags.Int64Var(&conf.Config.LocalConf.HTTPServerMaxBodySize, "mbs", 1<<20, "Max server body size in byte")
cmdFlags.Int64Var(&conf.Config.LocalConf.NetworkID, "networkID", 1, "Network ID")
cmdFlags.StringVar(&conf.Config.LocalConf.RunNodeMode, "runMode", consts.NoneOBS, "running node mode, example NONE|OBS|OBSMaster|SubNode")
cmdFlags.StringVar(&conf.Config.LocalConf.RunNodeMode, "runMode", consts.NoneCLB, "running node mode, example NONE|CLB|CLBMaster|SubNode")

// TCP Server
cmdFlags.StringVar(&conf.Config.TCPServer.Host, "tcpHost", "127.0.0.1", "Node TCP host")
Expand Down
4 changes: 2 additions & 2 deletions packages/api/errors.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,8 @@ var (
errUnauthorized = errType{"E_UNAUTHORIZED", "Unauthorized", http.StatusUnauthorized}
errUndefineval = errType{"E_UNDEFINEVAL", "Value %s is undefined", defaultStatus}
errUnknownUID = errType{"E_UNKNOWNUID", "Unknown uid", defaultStatus}
errOBS = errType{"E_OBS", "Virtual Dedicated Ecosystem %d doesn't exist", defaultStatus}
errOBSCreated = errType{"E_OBSCREATED", "Virtual Dedicated Ecosystem is already created", http.StatusBadRequest}
errCLB = errType{"E_CLB", "Virtual Dedicated Ecosystem %d doesn't exist", defaultStatus}
errCLBCreated = errType{"E_CLBCREATED", "Virtual Dedicated Ecosystem is already created", http.StatusBadRequest}
errRequestNotFound = errType{"E_REQUESTNOTFOUND", "Request %s doesn't exist", defaultStatus}
errUpdating = errType{"E_UPDATING", "Node is updating blockchain", http.StatusServiceUnavailable}
errStopping = errType{"E_STOPPING", "Network is stopping", http.StatusServiceUnavailable}
Expand Down
2 changes: 1 addition & 1 deletion packages/api/list.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ func (f *SumWhereForm) Validate(r *http.Request) error {

func checkAccess(tableName, columns string, client *Client) (table string, cols string, err error) {
sc := smart.SmartContract{
OBS: conf.Config.IsSupportingOBS(),
CLB: conf.Config.IsSupportingCLB(),
VM: script.GetVM(),
TxSmart: &types.SmartContract{
Header: &types.Header{
Expand Down
8 changes: 4 additions & 4 deletions packages/api/login.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ type loginResult struct {
NotifyKey string `json:"notify_key,omitempty"`
IsNode bool `json:"isnode,omitempty"`
IsOwner bool `json:"isowner,omitempty"`
IsOBS bool `json:"obs,omitempty"`
IsCLB bool `json:"clb,omitempty"`
Timestamp string `json:"timestamp,omitempty"`
Roles []rolesResult `json:"roles,omitempty"`
}
Expand Down Expand Up @@ -193,7 +193,7 @@ func (m Mode) loginHandler(w http.ResponseWriter, r *http.Request) {
return
}

if !conf.Config.IsSupportingOBS() {
if !conf.Config.IsSupportingCLB() {
gt := 3 * syspar.GetMaxBlockGenerationTime()
his := &model.History{}
for i := 0; i < 2; i++ {
Expand Down Expand Up @@ -284,7 +284,7 @@ func (m Mode) loginHandler(w http.ResponseWriter, r *http.Request) {
KeyID: converter.Int64ToStr(wallet),
IsOwner: founder == wallet,
IsNode: conf.Config.KeyID == wallet,
IsOBS: conf.Config.IsSupportingOBS(),
IsCLB: conf.Config.IsSupportingCLB(),
}

claims := JWTClaims{
Expand Down Expand Up @@ -381,7 +381,7 @@ func checkRoleFromParam(role, ecosystemID int64, account string) (int64, error)
}

func allowCreateUser(c *Client) bool {
if conf.Config.IsSupportingOBS() {
if conf.Config.IsSupportingCLB() {
return true
}

Expand Down
2 changes: 1 addition & 1 deletion packages/api/node.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import (
"net/http"
)

// nodeContract is used when calling a cron contract in OBS mode
// nodeContract is used when calling a cron contract in CLB mode
func nodeContractHandler(w http.ResponseWriter, r *http.Request) {
errorResponse(w, errNotImplemented)
}
20 changes: 10 additions & 10 deletions packages/obsmanager/config.go → packages/clbmanager/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* Copyright (c) IBAX. All rights reserved.
* See LICENSE in the project root for license information.
*--------------------------------------------------------------------------------------------*/
package obsmanager
package clbmanager

import (
"fmt"
Expand All @@ -16,8 +16,8 @@ const (
startCommand = "start"
)

// ChildOBSConfig struct to manage child entry
type ChildOBSConfig struct {
// ChildCLBConfig struct to manage child entry
type ChildCLBConfig struct {
Executable string
Name string
Directory string
Expand All @@ -29,7 +29,7 @@ type ChildOBSConfig struct {
HTTPPort int
}

func (c ChildOBSConfig) configCommand() *exec.Cmd {
func (c ChildCLBConfig) configCommand() *exec.Cmd {

args := []string{
"config",
Expand All @@ -42,29 +42,29 @@ func (c ChildOBSConfig) configCommand() *exec.Cmd {
fmt.Sprintf("--keysDir=%s", c.Directory),
fmt.Sprintf("--logTo=%s", c.LogTo),
fmt.Sprintf("--logLevel=%s", c.LogLevel),
"--obsMode=OBS",
"--clbMode=CLB",
}

return exec.Command(c.Executable, args...)
}

func (c ChildOBSConfig) initDBCommand() *exec.Cmd {
func (c ChildCLBConfig) initDBCommand() *exec.Cmd {
return c.getCommand(inidDBCommand)
}

func (c ChildOBSConfig) generateKeysCommand() *exec.Cmd {
func (c ChildCLBConfig) generateKeysCommand() *exec.Cmd {
return c.getCommand(genKeysCommand)
}

func (c ChildOBSConfig) startCommand() *exec.Cmd {
func (c ChildCLBConfig) startCommand() *exec.Cmd {
return c.getCommand(startCommand)
}

func (c ChildOBSConfig) configPath() string {
func (c ChildCLBConfig) configPath() string {
return filepath.Join(c.Directory, c.ConfigFileName)
}

func (c ChildOBSConfig) getCommand(commandName string) *exec.Cmd {
func (c ChildCLBConfig) getCommand(commandName string) *exec.Cmd {
args := []string{
commandName,
fmt.Sprintf("--config=%s", c.configPath()),
Expand Down
Loading

0 comments on commit 6111008

Please sign in to comment.