util

package
v0.7.0-beta.20 Latest Latest
Warning

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

Go to latest
Published: Nov 3, 2023 License: AGPL-3.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

View Source
const (
	RespTypEve  = "event"
	RespTypMsg  = "message"
	RespTypMeta = "metadata"
	RespEveSucc = "Success"
	RespEveFail = "Failed"

	GetOperation    OperationKind = "get"
	CreateOperation OperationKind = "create"
	DeleteOperation OperationKind = "delete"
	ListOperation   OperationKind = "list"

	CheckRunningOperation OperationKind = "checkRunning"
	CheckStatusOperation  OperationKind = "checkStatus"
	CheckRoleOperation    OperationKind = "checkRole"
	GetRoleOperation      OperationKind = "getRole"
	GetLagOperation       OperationKind = "getLag"
	SwitchoverOperation   OperationKind = "switchover"
	ExecOperation         OperationKind = "exec"
	QueryOperation        OperationKind = "query"
	CloseOperation        OperationKind = "close"

	LockOperation    OperationKind = "lockInstance"
	UnlockOperation  OperationKind = "unlockInstance"
	VolumeProtection OperationKind = "volumeProtection"

	// actions for cluster accounts management
	ListUsersOp          OperationKind = "listUsers"
	CreateUserOp         OperationKind = "createUser"
	DeleteUserOp         OperationKind = "deleteUser"
	DescribeUserOp       OperationKind = "describeUser"
	GrantUserRoleOp      OperationKind = "grantUserRole"
	RevokeUserRoleOp     OperationKind = "revokeUserRole"
	ListSystemAccountsOp OperationKind = "listSystemAccounts"

	JoinMemberOperation  OperationKind = "joinMember"
	LeaveMemberOperation OperationKind = "leaveMember"

	OperationNotImplemented = "NotImplemented"
	OperationInvalid        = "Invalid"
	OperationSuccess        = "Success"
	OperationFailed         = "Failed"

	HTTPRequestPrefx string = "curl -X POST -H 'Content-Type: application/json' http://localhost:%d/v1.0/bindings/%s"

	// this is a general script template, which can be used for all kinds of exec request to databases.
	DataScriptRequestTpl string = `` /* 305-byte string literal not displayed */

)
View Source
const (
	WorkloadTypeKey = "workloadType"
	Replication     = "Replication"
	Consensus       = "Consensus"
)
View Source
const (
	UnsupportedOps errorReason = "unsupported operation"
)

Variables

This section is empty.

Functions

func IsHAAvailable

func IsHAAvailable(characterType, workloadType string) bool

func IsUnSupportedError

func IsUnSupportedError(err error) bool

IsUnSupportedError checks if the error is unsupported operation error

Types

type OperationKind

type OperationKind string

type RoleType

type RoleType string
const (
	SuperUserRole  RoleType = "superuser"
	ReadWriteRole  RoleType = "readwrite"
	ReadOnlyRole   RoleType = "readonly"
	NoPrivileges   RoleType = ""
	CustomizedRole RoleType = "customized"
	InvalidRole    RoleType = "invalid"
)

func (RoleType) EqualTo

func (r RoleType) EqualTo(role string) bool

func (RoleType) GetWeight

func (r RoleType) GetWeight() int32

type SQLChannelError

type SQLChannelError struct {
	Reason errorReason
}

SQLChannelError is the error for sqlchannel, it implements error interface

func (SQLChannelError) Error

func (e SQLChannelError) Error() string

type SQLChannelMeta

type SQLChannelMeta struct {
	Operation string    `json:"operation,omitempty"`
	StartTime time.Time `json:"startTime,omitempty"`
	EndTime   time.Time `json:"endTime,omitempty"`
	Extra     string    `json:"extra,omitempty"`
}

SQLChannelMeta is the metadata for sqlchannel

type SQLChannelRequest

type SQLChannelRequest struct {
	Operation string                 `json:"operation"`
	Metadata  map[string]interface{} `json:"metadata,omitempty"`
}

SQLChannelRequest is the request for sqlchannel

type SQLChannelResponse

type SQLChannelResponse struct {
	Event    string         `json:"event,omitempty"`
	Message  string         `json:"message,omitempty"`
	Metadata SQLChannelMeta `json:"metadata,omitempty"`
}

SQLChannelResponse is the response for sqlchannel

type UserInfo

type UserInfo struct {
	UserName string        `json:"userName"`
	Password string        `json:"password,omitempty"`
	Expired  string        `json:"expired,omitempty"`
	ExpireAt time.Duration `json:"expireAt,omitempty"`
	RoleName string        `json:"roleName,omitempty"`
}

UserInfo is the user information for account management

Jump to

Keyboard shortcuts

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