concept

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Oct 12, 2021 License: MIT Imports: 28 Imported by: 0

README

cassemadm concepts

cassemdb has key structure like this:

root
	/elements
	|	|-app-1
	|	|	|-env-1
	|	|	|	|- elt-1
	|	|	|		|-metadata
	|	|	|		|-v1
	|	|	|		|-v2
	|	|	|-env-2
	|	|-app-2
	/apps
	|	|-app1
	|		|-metadata
	|	|-app2
	|		|-metadata
	/envs/
	|	|-env-1
	|		|-metadata
	|	|-env-1
	/locks
		|- appid-env-elt (lock metadata)

Documentation

Index

Constants

View Source
const (
	Action_READ    = "r"
	Action_WRITE   = "w"
	Action_DELETE  = "d"
	Action_PUBLISH = "p"
	Action_ANY     = "*"
)
View Source
const (
	Domain_ALL     = "*"
	Domain_CLUSTER = "cluster"
	// Domain_APP MUST NOT be used, this only represents the format of
	// app domain.
	Domain_APP = "app/env"
)

domain is equal to app/env

View Source
const (
	// Role_SUPERADMIN can control whole resources.
	// p superadmin * * *
	Role_SUPERADMIN = "superadmin"
	// Role_ADMIN is an admin role who owns all apps' all permissions.
	Role_ADMIN = "admin"
	// Role_APPOWNER can only control the app's resources which belong to him
	// and visit other apps's resources.
	Role_APPOWNER = "appowner"
	// Role_DEVELOPER can only access(except delete, publish, rollback permissions)
	// the app's resources which belong to him and visit other apps's resources.
	Role_DEVELOPER = "appdeveloper"
	// Role_VISITOR can only access(readonly) app's resources.
	Role_VISITOR = "visitor"
)
View Source
const (
	Object_USER    = "user"
	Object_ACL     = "acl"
	Object_APP     = "app"
	Object_ENV     = "env"
	Object_ELEMENT = "elem"
	Object_CLUSTER = "cluster"
	Object_ALL     = "*"
)

Variables

View Source
var AppMetadata_Status_name = map[int32]string{
	0: "INUSE",
	1: "DEPRECATED",
}
View Source
var AppMetadata_Status_value = map[string]int32{
	"INUSE":      0,
	"DEPRECATED": 1,
}
View Source
var ChangeOp_name = map[int32]string{
	0: "UNDEFINED",
	1: "NEW",
	2: "UPDATE",
	3: "DELETE",
}
View Source
var ChangeOp_value = map[string]int32{
	"UNDEFINED": 0,
	"NEW":       1,
	"UPDATE":    2,
	"DELETE":    3,
}
View Source
var ContentType_name = map[int32]string{
	0: "UNKNOWN",
	1: "JSON",
	2: "TOML",
	3: "INI",
	4: "PLAINTEXT",
}
View Source
var ContentType_value = map[string]int32{
	"UNKNOWN":   0,
	"JSON":      1,
	"TOML":      2,
	"INI":       3,
	"PLAINTEXT": 4,
}
View Source
var ElementOperation_Op_name = map[int32]string{
	0: "INVALID",
	1: "SET",
	2: "UNSET",
	3: "PUBLISH",
}
View Source
var ElementOperation_Op_value = map[string]int32{
	"INVALID": 0,
	"SET":     1,
	"UNSET":   2,
	"PUBLISH": 3,
}
View Source
var User_Status_name = map[int32]string{
	0: "NORMAL",
	1: "FORBIDDEN",
}
View Source
var User_Status_value = map[string]int32{
	"NORMAL":    0,
	"FORBIDDEN": 1,
}

Functions

func MarshalProto

func MarshalProto(v proto.Message) ([]byte, error)

func UnmarshalProto

func UnmarshalProto(data []byte, v proto.Message) error

Types

type AdmAggregate

type AdmAggregate interface {
	KVReadOnly
	KVWriteOnly
	InstanceHybrid
	AgentHybrid
	RBAC
}

AdmAggregate describes all methods should storage component should support.

func NewAdmAggregate

func NewAdmAggregate(endpoints []string) (AdmAggregate, error)

type AgentAggregate

type AgentAggregate interface {
	KVReadOnly
	InstanceHybrid
	AgentHybrid
}

func NewAgentAggregate

func NewAgentAggregate(endpoints []string) (AgentAggregate, error)

type AgentHybrid

type AgentHybrid interface {
	// Watch would block util any error happened, otherwise any change of agents will be
	// pushed into ch.
	Watch(ctx context.Context, ch chan<- *AgentInstanceChange) error
	// Register helps agent registers itself.
	Register(ctx context.Context, ins *AgentInstance, ttl int32) error
	// Renew helps agents keep online.
	Renew(ctx context.Context, ins *AgentInstance, ttl int32) error
	// Unregister helps agent unregister itself.
	Unregister(ctx context.Context, agentId string) error
	GetAgents(ctx context.Context, seek string, limit int) (*getAgentsResult, error)
}

AgentHybrid describes all methods to manage agent nodes in cassemdb.

type AgentInstance

type AgentInstance struct {
	// agentId is the unique identifier for agent.
	AgentId string `protobuf:"bytes,1,opt,name=agentId,proto3" json:"agentId,omitempty"`
	Addr    string `protobuf:"bytes,2,opt,name=addr,proto3" json:"addr,omitempty"`
	// annotations contains the some custom label and value of AgentInstance.
	Annotations          map[string]string `` /* 163-byte string literal not displayed */
	XXX_NoUnkeyedLiteral struct{}          `json:"-"`
	XXX_unrecognized     []byte            `json:"-"`
	XXX_sizecache        int32             `json:"-"`
}

AgentInstance describes agent node instance attributes.

func (*AgentInstance) Descriptor

func (*AgentInstance) Descriptor() ([]byte, []int)

func (*AgentInstance) GetAddr

func (m *AgentInstance) GetAddr() string

func (*AgentInstance) GetAgentId

func (m *AgentInstance) GetAgentId() string

func (*AgentInstance) GetAnnotations

func (m *AgentInstance) GetAnnotations() map[string]string

func (*AgentInstance) ProtoMessage

func (*AgentInstance) ProtoMessage()

func (*AgentInstance) Reset

func (m *AgentInstance) Reset()

func (*AgentInstance) String

func (m *AgentInstance) String() string

func (*AgentInstance) Validate

func (m *AgentInstance) Validate() error

Validate checks the field values on AgentInstance with the rules defined in the proto definition for this message. If any rules are violated, an error is returned.

func (*AgentInstance) XXX_DiscardUnknown

func (m *AgentInstance) XXX_DiscardUnknown()

func (*AgentInstance) XXX_Marshal

func (m *AgentInstance) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*AgentInstance) XXX_Merge

func (m *AgentInstance) XXX_Merge(src proto.Message)

func (*AgentInstance) XXX_Size

func (m *AgentInstance) XXX_Size() int

func (*AgentInstance) XXX_Unmarshal

func (m *AgentInstance) XXX_Unmarshal(b []byte) error

type AgentInstanceChange

type AgentInstanceChange struct {
	Ins                  *AgentInstance `protobuf:"bytes,1,opt,name=ins,proto3" json:"ins,omitempty"`
	Op                   ChangeOp       `protobuf:"varint,2,opt,name=op,proto3,enum=cassem.concept.ChangeOp" json:"op,omitempty"`
	XXX_NoUnkeyedLiteral struct{}       `json:"-"`
	XXX_unrecognized     []byte         `json:"-"`
	XXX_sizecache        int32          `json:"-"`
}

func (*AgentInstanceChange) Descriptor

func (*AgentInstanceChange) Descriptor() ([]byte, []int)

func (*AgentInstanceChange) GetIns

func (m *AgentInstanceChange) GetIns() *AgentInstance

func (*AgentInstanceChange) GetOp

func (m *AgentInstanceChange) GetOp() ChangeOp

func (*AgentInstanceChange) ProtoMessage

func (*AgentInstanceChange) ProtoMessage()

func (*AgentInstanceChange) Reset

func (m *AgentInstanceChange) Reset()

func (*AgentInstanceChange) String

func (m *AgentInstanceChange) String() string

func (*AgentInstanceChange) Validate

func (m *AgentInstanceChange) Validate() error

Validate checks the field values on AgentInstanceChange with the rules defined in the proto definition for this message. If any rules are violated, an error is returned.

func (*AgentInstanceChange) XXX_DiscardUnknown

func (m *AgentInstanceChange) XXX_DiscardUnknown()

func (*AgentInstanceChange) XXX_Marshal

func (m *AgentInstanceChange) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*AgentInstanceChange) XXX_Merge

func (m *AgentInstanceChange) XXX_Merge(src proto.Message)

func (*AgentInstanceChange) XXX_Size

func (m *AgentInstanceChange) XXX_Size() int

func (*AgentInstanceChange) XXX_Unmarshal

func (m *AgentInstanceChange) XXX_Unmarshal(b []byte) error

type AgentInstanceChangeValidationError

type AgentInstanceChangeValidationError struct {
	// contains filtered or unexported fields
}

AgentInstanceChangeValidationError is the validation error returned by AgentInstanceChange.Validate if the designated constraints aren't met.

func (AgentInstanceChangeValidationError) Cause

Cause function returns cause value.

func (AgentInstanceChangeValidationError) Error

Error satisfies the builtin error interface

func (AgentInstanceChangeValidationError) ErrorName

ErrorName returns error name.

func (AgentInstanceChangeValidationError) Field

Field function returns field value.

func (AgentInstanceChangeValidationError) Key

Key function returns key value.

func (AgentInstanceChangeValidationError) Reason

Reason function returns reason value.

type AgentInstanceValidationError

type AgentInstanceValidationError struct {
	// contains filtered or unexported fields
}

AgentInstanceValidationError is the validation error returned by AgentInstance.Validate if the designated constraints aren't met.

func (AgentInstanceValidationError) Cause

Cause function returns cause value.

func (AgentInstanceValidationError) Error

Error satisfies the builtin error interface

func (AgentInstanceValidationError) ErrorName

func (e AgentInstanceValidationError) ErrorName() string

ErrorName returns error name.

func (AgentInstanceValidationError) Field

Field function returns field value.

func (AgentInstanceValidationError) Key

Key function returns key value.

func (AgentInstanceValidationError) Reason

Reason function returns reason value.

type AppMetadata

type AppMetadata struct {
	Id          string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"`
	Description string `protobuf:"bytes,2,opt,name=description,proto3" json:"description,omitempty"`
	CreatedAt   int64  `protobuf:"varint,3,opt,name=createdAt,proto3" json:"createdAt,omitempty"`
	// creator of the app indicates the user who created the app.
	Creator string `protobuf:"bytes,4,opt,name=creator,proto3" json:"creator,omitempty"`
	// owner of the app indicates the user who actually own this app.
	// of course, admin account owns all apps.
	Owner  string             `protobuf:"bytes,5,opt,name=owner,proto3" json:"owner,omitempty"`
	Status AppMetadata_Status `protobuf:"varint,6,opt,name=status,proto3,enum=cassem.concept.AppMetadata_Status" json:"status,omitempty"`
	// secrets is the key to acccecss the app's elements by different envs. If it's empty,
	// that means the app is public.
	Secrets              map[string]string `` /* 155-byte string literal not displayed */
	XXX_NoUnkeyedLiteral struct{}          `json:"-"`
	XXX_unrecognized     []byte            `json:"-"`
	XXX_sizecache        int32             `json:"-"`
}

AppMetadata contains metadata of one app, includes specific identity, description, and other fields to display the app's status.

func (*AppMetadata) Descriptor

func (*AppMetadata) Descriptor() ([]byte, []int)

func (*AppMetadata) GetCreatedAt

func (m *AppMetadata) GetCreatedAt() int64

func (*AppMetadata) GetCreator

func (m *AppMetadata) GetCreator() string

func (*AppMetadata) GetDescription

func (m *AppMetadata) GetDescription() string

func (*AppMetadata) GetId

func (m *AppMetadata) GetId() string

func (*AppMetadata) GetOwner

func (m *AppMetadata) GetOwner() string

func (*AppMetadata) GetSecrets

func (m *AppMetadata) GetSecrets() map[string]string

func (*AppMetadata) GetStatus

func (m *AppMetadata) GetStatus() AppMetadata_Status

func (*AppMetadata) ProtoMessage

func (*AppMetadata) ProtoMessage()

func (*AppMetadata) Reset

func (m *AppMetadata) Reset()

func (*AppMetadata) String

func (m *AppMetadata) String() string

func (*AppMetadata) Validate

func (m *AppMetadata) Validate() error

Validate checks the field values on AppMetadata with the rules defined in the proto definition for this message. If any rules are violated, an error is returned.

func (*AppMetadata) XXX_DiscardUnknown

func (m *AppMetadata) XXX_DiscardUnknown()

func (*AppMetadata) XXX_Marshal

func (m *AppMetadata) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*AppMetadata) XXX_Merge

func (m *AppMetadata) XXX_Merge(src proto.Message)

func (*AppMetadata) XXX_Size

func (m *AppMetadata) XXX_Size() int

func (*AppMetadata) XXX_Unmarshal

func (m *AppMetadata) XXX_Unmarshal(b []byte) error

type AppMetadataValidationError

type AppMetadataValidationError struct {
	// contains filtered or unexported fields
}

AppMetadataValidationError is the validation error returned by AppMetadata.Validate if the designated constraints aren't met.

func (AppMetadataValidationError) Cause

Cause function returns cause value.

func (AppMetadataValidationError) Error

Error satisfies the builtin error interface

func (AppMetadataValidationError) ErrorName

func (e AppMetadataValidationError) ErrorName() string

ErrorName returns error name.

func (AppMetadataValidationError) Field

Field function returns field value.

func (AppMetadataValidationError) Key

Key function returns key value.

func (AppMetadataValidationError) Reason

Reason function returns reason value.

type AppMetadata_Status

type AppMetadata_Status int32
const (
	AppMetadata_INUSE AppMetadata_Status = 0
	// DEPRECATED represents the app is deprecated. It can only read but update.
	AppMetadata_DEPRECATED AppMetadata_Status = 1
)

func (AppMetadata_Status) EnumDescriptor

func (AppMetadata_Status) EnumDescriptor() ([]byte, []int)

func (AppMetadata_Status) String

func (x AppMetadata_Status) String() string

type Casbin

type Casbin struct {
	Policies             []*Casbin_Policy `protobuf:"bytes,1,rep,name=policies,proto3" json:"policies,omitempty"`
	XXX_NoUnkeyedLiteral struct{}         `json:"-"`
	XXX_unrecognized     []byte           `json:"-"`
	XXX_sizecache        int32            `json:"-"`
}

Casbin represent the casbin model.

func (*Casbin) Descriptor

func (*Casbin) Descriptor() ([]byte, []int)

func (*Casbin) GetPolicies

func (m *Casbin) GetPolicies() []*Casbin_Policy

func (*Casbin) ProtoMessage

func (*Casbin) ProtoMessage()

func (*Casbin) Reset

func (m *Casbin) Reset()

func (*Casbin) String

func (m *Casbin) String() string

func (*Casbin) Validate

func (m *Casbin) Validate() error

Validate checks the field values on Casbin with the rules defined in the proto definition for this message. If any rules are violated, an error is returned.

func (*Casbin) XXX_DiscardUnknown

func (m *Casbin) XXX_DiscardUnknown()

func (*Casbin) XXX_Marshal

func (m *Casbin) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*Casbin) XXX_Merge

func (m *Casbin) XXX_Merge(src proto.Message)

func (*Casbin) XXX_Size

func (m *Casbin) XXX_Size() int

func (*Casbin) XXX_Unmarshal

func (m *Casbin) XXX_Unmarshal(b []byte) error

type CasbinValidationError

type CasbinValidationError struct {
	// contains filtered or unexported fields
}

CasbinValidationError is the validation error returned by Casbin.Validate if the designated constraints aren't met.

func (CasbinValidationError) Cause

func (e CasbinValidationError) Cause() error

Cause function returns cause value.

func (CasbinValidationError) Error

func (e CasbinValidationError) Error() string

Error satisfies the builtin error interface

func (CasbinValidationError) ErrorName

func (e CasbinValidationError) ErrorName() string

ErrorName returns error name.

func (CasbinValidationError) Field

func (e CasbinValidationError) Field() string

Field function returns field value.

func (CasbinValidationError) Key

func (e CasbinValidationError) Key() bool

Key function returns key value.

func (CasbinValidationError) Reason

func (e CasbinValidationError) Reason() string

Reason function returns reason value.

type Casbin_Policy

type Casbin_Policy struct {
	Ptype                string   `protobuf:"bytes,1,opt,name=Ptype,proto3" json:"Ptype,omitempty"`
	V0                   string   `protobuf:"bytes,2,opt,name=V0,proto3" json:"V0,omitempty"`
	V1                   string   `protobuf:"bytes,3,opt,name=V1,proto3" json:"V1,omitempty"`
	V2                   string   `protobuf:"bytes,4,opt,name=V2,proto3" json:"V2,omitempty"`
	V3                   string   `protobuf:"bytes,5,opt,name=V3,proto3" json:"V3,omitempty"`
	V4                   string   `protobuf:"bytes,6,opt,name=V4,proto3" json:"V4,omitempty"`
	V5                   string   `protobuf:"bytes,7,opt,name=V5,proto3" json:"V5,omitempty"`
	XXX_NoUnkeyedLiteral struct{} `json:"-"`
	XXX_unrecognized     []byte   `json:"-"`
	XXX_sizecache        int32    `json:"-"`
}

func (*Casbin_Policy) Descriptor

func (*Casbin_Policy) Descriptor() ([]byte, []int)

func (*Casbin_Policy) GetPtype

func (m *Casbin_Policy) GetPtype() string

func (*Casbin_Policy) GetV0

func (m *Casbin_Policy) GetV0() string

func (*Casbin_Policy) GetV1

func (m *Casbin_Policy) GetV1() string

func (*Casbin_Policy) GetV2

func (m *Casbin_Policy) GetV2() string

func (*Casbin_Policy) GetV3

func (m *Casbin_Policy) GetV3() string

func (*Casbin_Policy) GetV4

func (m *Casbin_Policy) GetV4() string

func (*Casbin_Policy) GetV5

func (m *Casbin_Policy) GetV5() string

func (*Casbin_Policy) ProtoMessage

func (*Casbin_Policy) ProtoMessage()

func (*Casbin_Policy) Reset

func (m *Casbin_Policy) Reset()

func (*Casbin_Policy) String

func (m *Casbin_Policy) String() string

func (*Casbin_Policy) Validate

func (m *Casbin_Policy) Validate() error

Validate checks the field values on Casbin_Policy with the rules defined in the proto definition for this message. If any rules are violated, an error is returned.

func (*Casbin_Policy) XXX_DiscardUnknown

func (m *Casbin_Policy) XXX_DiscardUnknown()

func (*Casbin_Policy) XXX_Marshal

func (m *Casbin_Policy) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*Casbin_Policy) XXX_Merge

func (m *Casbin_Policy) XXX_Merge(src proto.Message)

func (*Casbin_Policy) XXX_Size

func (m *Casbin_Policy) XXX_Size() int

func (*Casbin_Policy) XXX_Unmarshal

func (m *Casbin_Policy) XXX_Unmarshal(b []byte) error

type Casbin_PolicyValidationError

type Casbin_PolicyValidationError struct {
	// contains filtered or unexported fields
}

Casbin_PolicyValidationError is the validation error returned by Casbin_Policy.Validate if the designated constraints aren't met.

func (Casbin_PolicyValidationError) Cause

Cause function returns cause value.

func (Casbin_PolicyValidationError) Error

Error satisfies the builtin error interface

func (Casbin_PolicyValidationError) ErrorName

func (e Casbin_PolicyValidationError) ErrorName() string

ErrorName returns error name.

func (Casbin_PolicyValidationError) Field

Field function returns field value.

func (Casbin_PolicyValidationError) Key

Key function returns key value.

func (Casbin_PolicyValidationError) Reason

Reason function returns reason value.

type ChangeOp

type ChangeOp int32
const (
	ChangeOp_UNDEFINED ChangeOp = 0
	ChangeOp_NEW       ChangeOp = 1
	ChangeOp_UPDATE    ChangeOp = 2
	ChangeOp_DELETE    ChangeOp = 3
)

func (ChangeOp) EnumDescriptor

func (ChangeOp) EnumDescriptor() ([]byte, []int)

func (ChangeOp) String

func (x ChangeOp) String() string

type ContentType

type ContentType int32

ContentType enumerates all built-in content types those Element's raw could be.

const (
	ContentType_UNKNOWN ContentType = 0
	// application/json
	ContentType_JSON ContentType = 1
	// application/toml
	ContentType_TOML ContentType = 2
	// application/ini
	ContentType_INI ContentType = 3
	// application/plaintext
	ContentType_PLAINTEXT ContentType = 4
)

func (ContentType) EnumDescriptor

func (ContentType) EnumDescriptor() ([]byte, []int)

func (ContentType) String

func (x ContentType) String() string

type Element

type Element struct {
	// refer ElementMetadata
	Metadata *ElementMetadata `protobuf:"bytes,1,opt,name=metadata,proto3" json:"metadata,omitempty"`
	// raw data in the version.
	Raw []byte `protobuf:"bytes,2,opt,name=raw,proto3" json:"raw,omitempty"`
	// version number start since 1.
	Version int32 `protobuf:"varint,3,opt,name=version,proto3" json:"version,omitempty"`
	// indicates published or not.
	Published            bool     `protobuf:"varint,4,opt,name=published,proto3" json:"published,omitempty"`
	XXX_NoUnkeyedLiteral struct{} `json:"-"`
	XXX_unrecognized     []byte   `json:"-"`
	XXX_sizecache        int32    `json:"-"`
}

Element represent a config element with specific version.

func (*Element) Descriptor

func (*Element) Descriptor() ([]byte, []int)

func (*Element) GetMetadata

func (m *Element) GetMetadata() *ElementMetadata

func (*Element) GetPublished

func (m *Element) GetPublished() bool

func (*Element) GetRaw

func (m *Element) GetRaw() []byte

func (*Element) GetVersion

func (m *Element) GetVersion() int32

func (*Element) MarshalJSON

func (m *Element) MarshalJSON() ([]byte, error)

func (*Element) ProtoMessage

func (*Element) ProtoMessage()

func (*Element) Reset

func (m *Element) Reset()

func (*Element) String

func (m *Element) String() string

func (*Element) Validate

func (m *Element) Validate() error

Validate checks the field values on Element with the rules defined in the proto definition for this message. If any rules are violated, an error is returned.

func (*Element) XXX_DiscardUnknown

func (m *Element) XXX_DiscardUnknown()

func (*Element) XXX_Marshal

func (m *Element) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*Element) XXX_Merge

func (m *Element) XXX_Merge(src proto.Message)

func (*Element) XXX_Size

func (m *Element) XXX_Size() int

func (*Element) XXX_Unmarshal

func (m *Element) XXX_Unmarshal(b []byte) error

type ElementMetadata

type ElementMetadata struct {
	Key string `protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty"`
	App string `protobuf:"bytes,2,opt,name=app,proto3" json:"app,omitempty"`
	Env string `protobuf:"bytes,3,opt,name=env,proto3" json:"env,omitempty"`
	// the latest version in all versions of the element.
	LatestVersion int32 `protobuf:"varint,4,opt,name=latestVersion,proto3" json:"latestVersion,omitempty"`
	// if there is any unpublished version, if there's any unpublished
	// version, the element can not create a new version util all versions have been
	// published,
	UnpublishedVersion int32 `protobuf:"varint,5,opt,name=unpublishedVersion,proto3" json:"unpublishedVersion,omitempty"`
	// the in-use version.
	UsingVersion int32 `protobuf:"varint,6,opt,name=usingVersion,proto3" json:"usingVersion,omitempty"`
	// the using version's fingerprint.
	UsingFingerprint string `protobuf:"bytes,7,opt,name=usingFingerprint,proto3" json:"usingFingerprint,omitempty"`
	// indicates the content type of Element's raw data
	ContentType          ContentType `protobuf:"varint,8,opt,name=contentType,proto3,enum=cassem.concept.ContentType" json:"contentType,omitempty"`
	XXX_NoUnkeyedLiteral struct{}    `json:"-"`
	XXX_unrecognized     []byte      `json:"-"`
	XXX_sizecache        int32       `json:"-"`
}

ElementMetadata contains metadata of one element, includes specific key, app, env attributes, and other fields to display the element's version status.

func (*ElementMetadata) Descriptor

func (*ElementMetadata) Descriptor() ([]byte, []int)

func (*ElementMetadata) GetApp

func (m *ElementMetadata) GetApp() string

func (*ElementMetadata) GetContentType

func (m *ElementMetadata) GetContentType() ContentType

func (*ElementMetadata) GetEnv

func (m *ElementMetadata) GetEnv() string

func (*ElementMetadata) GetKey

func (m *ElementMetadata) GetKey() string

func (*ElementMetadata) GetLatestVersion

func (m *ElementMetadata) GetLatestVersion() int32

func (*ElementMetadata) GetUnpublishedVersion

func (m *ElementMetadata) GetUnpublishedVersion() int32

func (*ElementMetadata) GetUsingFingerprint

func (m *ElementMetadata) GetUsingFingerprint() string

func (*ElementMetadata) GetUsingVersion

func (m *ElementMetadata) GetUsingVersion() int32

func (*ElementMetadata) MarshalJSON

func (m *ElementMetadata) MarshalJSON() ([]byte, error)

func (*ElementMetadata) ProtoMessage

func (*ElementMetadata) ProtoMessage()

func (*ElementMetadata) Reset

func (m *ElementMetadata) Reset()

func (*ElementMetadata) String

func (m *ElementMetadata) String() string

func (*ElementMetadata) Validate

func (m *ElementMetadata) Validate() error

Validate checks the field values on ElementMetadata with the rules defined in the proto definition for this message. If any rules are violated, an error is returned.

func (*ElementMetadata) XXX_DiscardUnknown

func (m *ElementMetadata) XXX_DiscardUnknown()

func (*ElementMetadata) XXX_Marshal

func (m *ElementMetadata) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*ElementMetadata) XXX_Merge

func (m *ElementMetadata) XXX_Merge(src proto.Message)

func (*ElementMetadata) XXX_Size

func (m *ElementMetadata) XXX_Size() int

func (*ElementMetadata) XXX_Unmarshal

func (m *ElementMetadata) XXX_Unmarshal(b []byte) error

type ElementMetadataValidationError

type ElementMetadataValidationError struct {
	// contains filtered or unexported fields
}

ElementMetadataValidationError is the validation error returned by ElementMetadata.Validate if the designated constraints aren't met.

func (ElementMetadataValidationError) Cause

Cause function returns cause value.

func (ElementMetadataValidationError) Error

Error satisfies the builtin error interface

func (ElementMetadataValidationError) ErrorName

func (e ElementMetadataValidationError) ErrorName() string

ErrorName returns error name.

func (ElementMetadataValidationError) Field

Field function returns field value.

func (ElementMetadataValidationError) Key

Key function returns key value.

func (ElementMetadataValidationError) Reason

Reason function returns reason value.

type ElementOperation

type ElementOperation struct {
	// operator indicates the user who execute the operation.
	Operator             string              `protobuf:"bytes,1,opt,name=operator,proto3" json:"operator,omitempty"`
	OperatedAt           int64               `protobuf:"varint,2,opt,name=operatedAt,proto3" json:"operatedAt,omitempty"`
	OperatedKey          string              `protobuf:"bytes,3,opt,name=operatedKey,proto3" json:"operatedKey,omitempty"`
	Op                   ElementOperation_Op `protobuf:"varint,4,opt,name=op,proto3,enum=cassem.concept.ElementOperation_Op" json:"op,omitempty"`
	LastVersion          int32               `protobuf:"varint,5,opt,name=lastVersion,proto3" json:"lastVersion,omitempty"`
	CurrentVersion       int32               `protobuf:"varint,6,opt,name=currentVersion,proto3" json:"currentVersion,omitempty"`
	Remark               string              `protobuf:"bytes,7,opt,name=remark,proto3" json:"remark,omitempty"`
	XXX_NoUnkeyedLiteral struct{}            `json:"-"`
	XXX_unrecognized     []byte              `json:"-"`
	XXX_sizecache        int32               `json:"-"`
}

ElementOperation is used to indicate the operation of one element.

func (*ElementOperation) Descriptor

func (*ElementOperation) Descriptor() ([]byte, []int)

func (*ElementOperation) GetCurrentVersion

func (m *ElementOperation) GetCurrentVersion() int32

func (*ElementOperation) GetLastVersion

func (m *ElementOperation) GetLastVersion() int32

func (*ElementOperation) GetOp

func (*ElementOperation) GetOperatedAt

func (m *ElementOperation) GetOperatedAt() int64

func (*ElementOperation) GetOperatedKey

func (m *ElementOperation) GetOperatedKey() string

func (*ElementOperation) GetOperator

func (m *ElementOperation) GetOperator() string

func (*ElementOperation) GetRemark

func (m *ElementOperation) GetRemark() string

func (*ElementOperation) ProtoMessage

func (*ElementOperation) ProtoMessage()

func (*ElementOperation) Reset

func (m *ElementOperation) Reset()

func (*ElementOperation) String

func (m *ElementOperation) String() string

func (*ElementOperation) Validate

func (m *ElementOperation) Validate() error

Validate checks the field values on ElementOperation with the rules defined in the proto definition for this message. If any rules are violated, an error is returned.

func (*ElementOperation) XXX_DiscardUnknown

func (m *ElementOperation) XXX_DiscardUnknown()

func (*ElementOperation) XXX_Marshal

func (m *ElementOperation) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*ElementOperation) XXX_Merge

func (m *ElementOperation) XXX_Merge(src proto.Message)

func (*ElementOperation) XXX_Size

func (m *ElementOperation) XXX_Size() int

func (*ElementOperation) XXX_Unmarshal

func (m *ElementOperation) XXX_Unmarshal(b []byte) error

type ElementOperationValidationError

type ElementOperationValidationError struct {
	// contains filtered or unexported fields
}

ElementOperationValidationError is the validation error returned by ElementOperation.Validate if the designated constraints aren't met.

func (ElementOperationValidationError) Cause

Cause function returns cause value.

func (ElementOperationValidationError) Error

Error satisfies the builtin error interface

func (ElementOperationValidationError) ErrorName

ErrorName returns error name.

func (ElementOperationValidationError) Field

Field function returns field value.

func (ElementOperationValidationError) Key

Key function returns key value.

func (ElementOperationValidationError) Reason

Reason function returns reason value.

type ElementOperation_Op

type ElementOperation_Op int32
const (
	ElementOperation_INVALID ElementOperation_Op = 0
	ElementOperation_SET     ElementOperation_Op = 1
	ElementOperation_UNSET   ElementOperation_Op = 2
	ElementOperation_PUBLISH ElementOperation_Op = 3
)

func (ElementOperation_Op) EnumDescriptor

func (ElementOperation_Op) EnumDescriptor() ([]byte, []int)

func (ElementOperation_Op) String

func (x ElementOperation_Op) String() string

type ElementValidationError

type ElementValidationError struct {
	// contains filtered or unexported fields
}

ElementValidationError is the validation error returned by Element.Validate if the designated constraints aren't met.

func (ElementValidationError) Cause

func (e ElementValidationError) Cause() error

Cause function returns cause value.

func (ElementValidationError) Error

func (e ElementValidationError) Error() string

Error satisfies the builtin error interface

func (ElementValidationError) ErrorName

func (e ElementValidationError) ErrorName() string

ErrorName returns error name.

func (ElementValidationError) Field

func (e ElementValidationError) Field() string

Field function returns field value.

func (ElementValidationError) Key

func (e ElementValidationError) Key() bool

Key function returns key value.

func (ElementValidationError) Reason

func (e ElementValidationError) Reason() string

Reason function returns reason value.

type Instance

type Instance struct {
	ClientId             string               `protobuf:"bytes,1,opt,name=clientId,proto3" json:"clientId,omitempty"`
	AgentId              string               `protobuf:"bytes,2,opt,name=agentId,proto3" json:"agentId,omitempty"`
	ClientIp             string               `protobuf:"bytes,3,opt,name=clientIp,proto3" json:"clientIp,omitempty"`
	Watching             []*Instance_Watching `protobuf:"bytes,4,rep,name=watching,proto3" json:"watching,omitempty"`
	LastRenewTimestamp   int64                `protobuf:"varint,5,opt,name=lastRenewTimestamp,proto3" json:"lastRenewTimestamp,omitempty"`
	XXX_NoUnkeyedLiteral struct{}             `json:"-"`
	XXX_unrecognized     []byte               `json:"-"`
	XXX_sizecache        int32                `json:"-"`
}

Instance describes client instance.

func (*Instance) Descriptor

func (*Instance) Descriptor() ([]byte, []int)

func (*Instance) GetAgentId

func (m *Instance) GetAgentId() string

func (*Instance) GetClientId

func (m *Instance) GetClientId() string

func (*Instance) GetClientIp

func (m *Instance) GetClientIp() string

func (*Instance) GetLastRenewTimestamp

func (m *Instance) GetLastRenewTimestamp() int64

func (*Instance) GetWatching

func (m *Instance) GetWatching() []*Instance_Watching

func (*Instance) Id

func (m *Instance) Id() string

func (*Instance) ProtoMessage

func (*Instance) ProtoMessage()

func (*Instance) Reset

func (m *Instance) Reset()

func (*Instance) String

func (m *Instance) String() string

func (*Instance) Validate

func (m *Instance) Validate() error

Validate checks the field values on Instance with the rules defined in the proto definition for this message. If any rules are violated, an error is returned.

func (*Instance) XXX_DiscardUnknown

func (m *Instance) XXX_DiscardUnknown()

func (*Instance) XXX_Marshal

func (m *Instance) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*Instance) XXX_Merge

func (m *Instance) XXX_Merge(src proto.Message)

func (*Instance) XXX_Size

func (m *Instance) XXX_Size() int

func (*Instance) XXX_Unmarshal

func (m *Instance) XXX_Unmarshal(b []byte) error

type InstanceHybrid

type InstanceHybrid interface {
	// GetInstances get all instance those have registered into cluster.
	GetInstances(ctx context.Context, seek string, limit int) (*getInstancesResult, error)
	// GetInstancesByElement get all instance those watching this app/env/key.
	GetInstancesByElement(ctx context.Context, app, env, key string) (*getInstancesResult, error)

	// GetInstance describes instance detail by insId.
	GetInstance(ctx context.Context, insId string) (*Instance, error)

	RegisterInstance(ctx context.Context, ins *Instance) error
	RenewInstance(ctx context.Context, ins *Instance) error
	UnregisterInstance(ctx context.Context, insId string) error
}

InstanceHybrid describes all methods to manages instance information.

type InstanceValidationError

type InstanceValidationError struct {
	// contains filtered or unexported fields
}

InstanceValidationError is the validation error returned by Instance.Validate if the designated constraints aren't met.

func (InstanceValidationError) Cause

func (e InstanceValidationError) Cause() error

Cause function returns cause value.

func (InstanceValidationError) Error

func (e InstanceValidationError) Error() string

Error satisfies the builtin error interface

func (InstanceValidationError) ErrorName

func (e InstanceValidationError) ErrorName() string

ErrorName returns error name.

func (InstanceValidationError) Field

func (e InstanceValidationError) Field() string

Field function returns field value.

func (InstanceValidationError) Key

func (e InstanceValidationError) Key() bool

Key function returns key value.

func (InstanceValidationError) Reason

func (e InstanceValidationError) Reason() string

Reason function returns reason value.

type Instance_Watching

type Instance_Watching struct {
	App                  string   `protobuf:"bytes,1,opt,name=app,proto3" json:"app,omitempty"`
	Env                  string   `protobuf:"bytes,2,opt,name=env,proto3" json:"env,omitempty"`
	WatchKeys            []string `protobuf:"bytes,3,rep,name=watchKeys,proto3" json:"watchKeys,omitempty"`
	XXX_NoUnkeyedLiteral struct{} `json:"-"`
	XXX_unrecognized     []byte   `json:"-"`
	XXX_sizecache        int32    `json:"-"`
}

func (*Instance_Watching) Descriptor

func (*Instance_Watching) Descriptor() ([]byte, []int)

func (*Instance_Watching) GetApp

func (m *Instance_Watching) GetApp() string

func (*Instance_Watching) GetEnv

func (m *Instance_Watching) GetEnv() string

func (*Instance_Watching) GetWatchKeys

func (m *Instance_Watching) GetWatchKeys() []string

func (*Instance_Watching) ProtoMessage

func (*Instance_Watching) ProtoMessage()

func (*Instance_Watching) Reset

func (m *Instance_Watching) Reset()

func (*Instance_Watching) String

func (m *Instance_Watching) String() string

func (*Instance_Watching) Validate

func (m *Instance_Watching) Validate() error

Validate checks the field values on Instance_Watching with the rules defined in the proto definition for this message. If any rules are violated, an error is returned.

func (*Instance_Watching) XXX_DiscardUnknown

func (m *Instance_Watching) XXX_DiscardUnknown()

func (*Instance_Watching) XXX_Marshal

func (m *Instance_Watching) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*Instance_Watching) XXX_Merge

func (m *Instance_Watching) XXX_Merge(src proto.Message)

func (*Instance_Watching) XXX_Size

func (m *Instance_Watching) XXX_Size() int

func (*Instance_Watching) XXX_Unmarshal

func (m *Instance_Watching) XXX_Unmarshal(b []byte) error

type Instance_WatchingValidationError

type Instance_WatchingValidationError struct {
	// contains filtered or unexported fields
}

Instance_WatchingValidationError is the validation error returned by Instance_Watching.Validate if the designated constraints aren't met.

func (Instance_WatchingValidationError) Cause

Cause function returns cause value.

func (Instance_WatchingValidationError) Error

Error satisfies the builtin error interface

func (Instance_WatchingValidationError) ErrorName

ErrorName returns error name.

func (Instance_WatchingValidationError) Field

Field function returns field value.

func (Instance_WatchingValidationError) Key

Key function returns key value.

func (Instance_WatchingValidationError) Reason

Reason function returns reason value.

type KVReadOnly

type KVReadOnly interface {
	GetElementWithVersion(ctx context.Context, app, env, key string, version int) (*Element, error)
	GetElementVersions(ctx context.Context, app, env, key string,
		seek string, limit int) (*getElementsResult, error)
	GetElements(ctx context.Context, app, env string, seek string, limit int) (*getElementsResult, error)
	GetElementsByKeys(ctx context.Context, app, env string, keys []string) (*getElementsResult, error)
	GetElementOperations(
		ctx context.Context, app, env, key string, start int) (ops []*ElementOperation, next int, err error)

	GetApp(ctx context.Context, app string) (*AppMetadata, error)
	GetApps(ctx context.Context, seek string, limit int) (*getAppsResult, error)

	GetEnvironments(ctx context.Context, app, seek string, limit int) (*getAppEnvsResult, error)
}

func NewKVReader

func NewKVReader(endpoints []string) (KVReadOnly, error)

NewKVReader with endpoints these endpoints of cassemdb.

type KVWriteOnly

type KVWriteOnly interface {
	CreateElement(ctx context.Context, app, env, key string, raw []byte, contentTyp ContentType) error
	UpdateElement(ctx context.Context, app, env, key string, raw []byte) error
	DeleteElement(ctx context.Context, app, env, key string) error

	CreateEnvironment(ctx context.Context, app, env string) error
	DeleteEnvironment(ctx context.Context, app, env string) error

	RollbackElementVersion(ctx context.Context, app string, env string, key string,
		rollbackVersion uint32) error
	PublishElementVersion(ctx context.Context, app string, env string, key string,
		publishVersion uint32) (*Element, error)

	CreateApp(ctx context.Context, md *AppMetadata) error
	DeleteApp(ctx context.Context, appId string) error
}

func NewKVHybrid

func NewKVHybrid(endpoints []string) (KVWriteOnly, error)

NewKVHybrid with endpoints these endpoints of cassemdb.

type PublishingMode

type PublishingMode uint8

PublishingMode indicates how to publish the element's update.

const (
	// PublishMode_GRAY gray publish mode only push to specified instance.
	PublishMode_GRAY PublishingMode = iota + 1
	// PublishMode_FULL full publish mode, push to all instances.
	PublishMode_FULL
)

type RBAC

type RBAC interface {
	GetUser(account string) (*User, error)
	AddUser(u *User) error
	DisableUser(account string) error
	AssignRole(account, role string, domain ...string) error
	RevokeRole(account, role string, domain ...string) error
	Enforce(subject, domain, object, act string) (bool, error)
}

RBAC is an ACL model to implement authentication permission management.

type User

type User struct {
	// account
	Account              string      `protobuf:"bytes,1,opt,name=account,proto3" json:"account,omitempty"`
	Nickname             string      `protobuf:"bytes,2,opt,name=nickname,proto3" json:"nickname,omitempty"`
	HashedPassword       string      `protobuf:"bytes,3,opt,name=hashedPassword,proto3" json:"hashedPassword,omitempty"`
	Salt                 string      `protobuf:"bytes,4,opt,name=salt,proto3" json:"salt,omitempty"`
	Status               User_Status `protobuf:"varint,5,opt,name=status,proto3,enum=cassem.concept.User_Status" json:"status,omitempty"`
	XXX_NoUnkeyedLiteral struct{}    `json:"-"`
	XXX_unrecognized     []byte      `json:"-"`
	XXX_sizecache        int32       `json:"-"`
}

func (*User) Descriptor

func (*User) Descriptor() ([]byte, []int)

func (*User) GetAccount

func (m *User) GetAccount() string

func (*User) GetHashedPassword

func (m *User) GetHashedPassword() string

func (*User) GetNickname

func (m *User) GetNickname() string

func (*User) GetSalt

func (m *User) GetSalt() string

func (*User) GetStatus

func (m *User) GetStatus() User_Status

func (*User) ProtoMessage

func (*User) ProtoMessage()

func (*User) Reset

func (m *User) Reset()

func (*User) String

func (m *User) String() string

func (*User) Validate

func (m *User) Validate() error

Validate checks the field values on User with the rules defined in the proto definition for this message. If any rules are violated, an error is returned.

func (*User) XXX_DiscardUnknown

func (m *User) XXX_DiscardUnknown()

func (*User) XXX_Marshal

func (m *User) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*User) XXX_Merge

func (m *User) XXX_Merge(src proto.Message)

func (*User) XXX_Size

func (m *User) XXX_Size() int

func (*User) XXX_Unmarshal

func (m *User) XXX_Unmarshal(b []byte) error

type UserValidationError

type UserValidationError struct {
	// contains filtered or unexported fields
}

UserValidationError is the validation error returned by User.Validate if the designated constraints aren't met.

func (UserValidationError) Cause

func (e UserValidationError) Cause() error

Cause function returns cause value.

func (UserValidationError) Error

func (e UserValidationError) Error() string

Error satisfies the builtin error interface

func (UserValidationError) ErrorName

func (e UserValidationError) ErrorName() string

ErrorName returns error name.

func (UserValidationError) Field

func (e UserValidationError) Field() string

Field function returns field value.

func (UserValidationError) Key

func (e UserValidationError) Key() bool

Key function returns key value.

func (UserValidationError) Reason

func (e UserValidationError) Reason() string

Reason function returns reason value.

type User_Status

type User_Status int32
const (
	User_NORMAL User_Status = 0
	// FORBIDDEN indicates the user is forbidden to access the system.
	User_FORBIDDEN User_Status = 1
)

func (User_Status) EnumDescriptor

func (User_Status) EnumDescriptor() ([]byte, []int)

func (User_Status) String

func (x User_Status) String() string

Jump to

Keyboard shortcuts

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