entity

package
v3.5.8 Latest Latest
Warning

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

Go to latest
Published: Oct 28, 2025 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ReplicasOK       = 1
	ReplicasNotReady = 2
)
View Source
const (
	Drop string = "DROP"
	Add  string = "ADD"
)
View Source
const (
	ReplicaStateProbe     = "ReplicaStateProbe"
	ReplicaStateReplicate = "ReplicaStateReplicate"
)
View Source
const (
	Create  = 0
	Restore = 1
)
View Source
const (
	DefaultReadRequestLimitCount  = 1000000.0
	DefaultWriteRequestLimitCount = 1000000.0
)
View Source
const (
	IdField    = "_id"
	ScoreField = "_score"
)
View Source
const (
	FieldOption_Null        vearchpb.FieldOption = 0
	FieldOption_Index       vearchpb.FieldOption = 1
	FieldOption_Index_False vearchpb.FieldOption = 2
)
View Source
const ClusterCleanJobKey = "/cluster/cleanjob"

when master running clean job , it will set value to this key, when other got key , now time less than this they will skip this job

View Source
const ClusterWatchServerKeyDelete = "watch/server/delete"
View Source
const ClusterWatchServerKeyPut = "watch/server/put"

ClusterWatchServerKey for server job lock

View Source
const ClusterWatchServerKeyScan = "watch/server/scan"
View Source
const MaxPartitions = 1024
View Source
const MaxTotalPartitions = 1024 * 16
View Source
const RESTART = "restart.txt"
View Source
const RootName = "root"

Variables

View Source
var (
	NodeIdSequence      = "/id/node"
	SpaceIdSequence     = "/id/space"
	DBIdSequence        = "/id/db"
	PartitionIdSequence = "/id/partition"
)

sids sequence key for etcd

View Source
var (
	Prefix             = "/"
	PrefixUser         = "/user/"
	PrefixLock         = "/lock/"
	PrefixLockCluster  = "/lock/cluster"
	PrefixServer       = "/server/"
	PrefixSpace        = "/space/"
	PrefixSpaceConfig  = "/space_config/"
	PrefixPartition    = "/partition/"
	PrefixDataBase     = "/db/"
	PrefixDataBaseBody = "/db/body/"
	PrefixFailServer   = "/fail/server/"
	PrefixRouter       = "/router/"
	PrefixNodeId       = "/id/node"
	PrefixSpaceId      = "/id/space"
	PrefixDBId         = "/id/db"
	PrefixPartitionId  = "/id/partition"
	PrefixAlias        = "/alias/"
	PrefixRole         = "/role/"
	PrefixMasterMember = "/member/"
)
View Source
var (
	ReadLimiter  = rate.NewLimiter(rate.Limit(rate.Inf), 0)
	WriteLimiter = rate.NewLimiter(rate.Limit(rate.Inf), 0)
)
View Source
var (
	MinNlinks                   = 8
	MaxNlinks                   = 96
	MinEfConstruction           = 16
	MaxEfConstruction           = 1024
	DefaultMetricType           = "InnerProduct"
	MinNcentroids               = 1
	MaxNcentroids               = 262144
	DefaultTrainingThreshold    = 0
	MinTrainingThreshold        = 256
	DefaultMaxPointsPerCentroid = 256
	DefaultMinPointsPerCentroid = 39
	DefaultRefreshInterval      = 1000 // 1s
	DefaultEnableIdCache        = false
)
View Source
var ClusterAdminRole = Role{Name: "defaultClusterAdmin", Privileges: ClusterPrivilege}
View Source
var ClusterPrivilege = map[Resource]Privilege{
	"ResourceCluster":   WriteRead,
	"ResourceServer":    WriteRead,
	"ResourcePartition": WriteRead,
	"ResourceDB":        WriteRead,
	"ResourceSpace":     WriteRead,
	"ResourceDocument":  WriteRead,
	"ResourceIndex":     WriteRead,
	"ResourceAlias":     WriteRead,
	"ResourceConfig":    WriteRead,
	"ResourceUser":      WriteRead,
	"ResourceRole":      WriteRead,
}
View Source
var DocumentAdminPrivilege = map[Resource]Privilege{
	"ResourceDocument": WriteRead,
	"ResourceIndex":    WriteRead,
}
View Source
var DocumentAdminRole = Role{Name: "defaultDocumentAdmin", Privileges: DocumentAdminPrivilege}
View Source
var DocumentReadPrivilege = map[Resource]Privilege{
	"ResourceDocument": ReadOnly,
	"ResourceIndex":    ReadOnly,
}
View Source
var PrefixEtcdClusterID = "/vearch/default/"
View Source
var PriviMap = map[Privilege]string{
	None:      "None",
	WriteOnly: "WriteOnly",
	ReadOnly:  "ReadOnly",
	WriteRead: "WriteRead",
}
View Source
var ReadDBSpaceEditDocumentPrivilege = map[Resource]Privilege{
	"ResourceCluster":  ReadOnly,
	"ResourceDB":       ReadOnly,
	"ResourceSpace":    ReadOnly,
	"ResourceDocument": WriteRead,
	"ResourceIndex":    WriteRead,
	"ResourceAlias":    ReadOnly,
}
View Source
var ReadDBSpaceEditDocumentRole = Role{Name: "defaultReadDBSpaceEditDocument", Privileges: ReadDBSpaceEditDocumentPrivilege}
View Source
var ReadSpaceEditDocumentPrivilege = map[Resource]Privilege{
	"ResourceSpace":    ReadOnly,
	"ResourceDocument": WriteRead,
	"ResourceIndex":    WriteRead,
	"ResourceAlias":    ReadOnly,
}
View Source
var ReadSpaceEditDocumentRole = Role{Name: "defaultReadSpaceEditDocument", Privileges: ReadSpaceEditDocumentPrivilege}
View Source
var ResourceMap = map[Resource]string{
	ResourceAll:       "ResourceAll",
	ResourceCluster:   "ResourceCluster",
	ResourceServer:    "ResourceServer",
	ResourcePartition: "ResourcePartition",
	ResourceDB:        "ResourceDB",
	ResourceSpace:     "ResourceSpace",
	ResourceDocument:  "ResourceDocument",
	ResourceIndex:     "ResourceIndex",
	ResourceAlias:     "ResourceAlias",
	ResourceUser:      "ResourceUser",
	ResourceRole:      "ResourceRole",
	ResourceConfig:    "ResourceConfig",
	ResourceCache:     "ResourceCache",
}
View Source
var RoleMap = map[string]Role{
	"root":                           RootRole,
	"defaultClusterAdmin":            ClusterAdminRole,
	"defaultSpaceAdmin":              SpaceAdminRole,
	"defaultDocumentAdmin":           DocumentAdminRole,
	"defaultReadDBSpaceEditDocument": ReadDBSpaceEditDocumentRole,
	"defaultReadSpaceEditDocument":   ReadSpaceEditDocumentRole,
}
View Source
var RootPrivilege = map[Resource]Privilege{
	"ResourceAll": WriteRead,
}
View Source
var RootRole = Role{Name: "root", Privileges: RootPrivilege}
View Source
var SpaceAdminPrivilege = map[Resource]Privilege{
	"ResourceSpace":    WriteRead,
	"ResourceDocument": WriteRead,
	"ResourceIndex":    WriteRead,
	"ResourceAlias":    ReadOnly,
}
View Source
var SpaceAdminRole = Role{Name: "defaultSpaceAdmin", Privileges: SpaceAdminPrivilege}

Functions

func AliasKey

func AliasKey(aliasName string) string

func DBKeyBody

func DBKeyBody(id int64) string

func DBKeyId

func DBKeyId(id int64) string

func DBKeyName

func DBKeyName(name string) string

func FailServerKey

func FailServerKey(nodeID uint64) string

FailServerKey generate fail server key

func HasPrivi

func HasPrivi(userPrivi PrivilegeType, checkPrivi PrivilegeType) bool

func LockAliasKey

func LockAliasKey(aliasName string) string

func LockDBKey added in v3.5.2

func LockDBKey(db string) string

func LockRoleKey added in v3.5.2

func LockRoleKey(rolename string) string

func LockSpaceKey

func LockSpaceKey(db, space string) string

func LockUserKey added in v3.5.2

func LockUserKey(username string) string

func MasterMemberKey added in v3.5.5

func MasterMemberKey(ID uint64) string

func ParseResources added in v3.5.2

func ParseResources(endpoint string, method string) (resource Resource, privilege Privilege)

func PartitionKey

func PartitionKey(partitionID uint32) string

func RoleKey added in v3.5.2

func RoleKey(rolename string) string

func RouterConfigKey added in v3.5.8

func RouterConfigKey(key string) string

func RouterKey

func RouterKey(key, value string) string

RouterKey Router key

func ServerKey

func ServerKey(name NodeID) string

func SetPrefixAndSequence

func SetPrefixAndSequence(cluster_id string)

func SetRequestLimit added in v3.5.8

func SetRequestLimit(router *RouterLimitCfg)

func SetRouterCount added in v3.5.8

func SetRouterCount(add bool)

func SpaceConfigKey added in v3.5.5

func SpaceConfigKey(dbID, spaceId int64) string

func SpaceKey

func SpaceKey(dbID, spaceId int64) string

func ToTimestamp added in v3.5.2

func ToTimestamp(value string) (int64, error)

func UnmarshalPropertyJSON

func UnmarshalPropertyJSON(propertity []byte) (map[string]*SpaceProperties, error)

func UserKey

func UserKey(username string) string

func ValidateName added in v3.5.2

func ValidateName(name string, name_type NameType, check_root bool) error

Types

type AddMemberRequest added in v3.5.5

type AddMemberRequest struct {
	PeerAddrs []string `json:"peer_addrs,omitempty"`
}

type Alias

type Alias struct {
	Name      string `json:"name,omitempty"`
	DbName    string `json:"db_name,omitempty"`
	SpaceName string `json:"space_name,omitempty"`
}

alias/dbName/spaceName

func (*Alias) Validate

func (alias *Alias) Validate() error

type BackupSpaceRequest added in v3.5.7

type BackupSpaceRequest struct {
	Command  string      `json:"command,omitempty"`
	BackupID int         `json:"backup_id,omitempty"`
	Part     PartitionID `json:"part"`
	S3Param  struct {
		Region     string `json:"region"`
		BucketName string `json:"bucket_name"`
		EndPoint   string `json:"endpoint"`
		AccessKey  string `json:"access_key"`
		SecretKey  string `json:"secret_key"`
		UseSSL     bool   `json:"use_ssl"`
	} `json:"s3_param,omitempty"`
}

type BackupSpaceResponse added in v3.5.7

type BackupSpaceResponse struct {
	BackupID  int   `json:"backup_id,omitempty"`
	BackupIDs []int `json:"backup_ids,omitempty"`
}

type BuildVersion

type BuildVersion struct {
	BuildVersion string `json:"build_version"`
	BuildTime    string `json:"build_time"`
	CommitID     string `json:"commit_id"`
}

type CTX_KEY

type CTX_KEY string

rpc time out, default 10 * 1000 ms

var (
	RPC_TIME_OUT CTX_KEY = "rpc_timeout"
)

type ChangeMember

type ChangeMember struct {
	PartitionID PartitionID          `json:"partition_id"`
	NodeID      NodeID               `json:"node_id"`
	Method      proto.ConfChangeType `json:"method"`
}

type ChangeMembers

type ChangeMembers struct {
	PartitionIDs []PartitionID        `json:"partition_ids"`
	NodeID       NodeID               `json:"node_id"`
	Method       proto.ConfChangeType `json:"method"`
}

type DB

type DB struct {
	Id   DBID     `json:"id,omitempty"`
	Name string   `json:"name,omitempty"`
	Ps   []string `json:"ps,omitempty"` //if set this , your db only use you config ps
}

db/id/[dbId]:[dbName] db/name/[dbName]:[dbId] db/body/[dbId]:[dbBody]

func (*DB) Validate

func (db *DB) Validate() error

type DBID

type DBID = int64

DBID is a custom type for database ID

type DBModify

type DBModify struct {
	DbName    string               `json:"db_name"`
	SpaceName string               `json:"space_name"`
	IPAddr    string               `json:"ip_addr"`
	Method    proto.ConfChangeType `json:"method"`
}

type EngineStatus added in v3.5.2

type EngineStatus struct {
	IndexStatus   int32 `json:"index_status,omitempty"`
	BackupStatus  int32 `json:"backup_status,omitempty"`
	DocNum        int32 `json:"doc_num,omitempty"`
	MinIndexedNum int32 `json:"min_indexed_num,omitempty"`
	MaxDocid      int32 `json:"max_docid,omitempty"`
}

type FailServer

type FailServer struct {
	ID        NodeID  `json:"nodeID,omitempty"` //unique name for raft
	TimeStamp int64   `json:"time_stamp,omitempty"`
	Node      *Server `json:"server,omitempty"`
}

FailServer /fail/server/id:[body] ttl 3m 3s

type Field

type Field struct {
	Name       string  `json:"name"`
	Type       string  `json:"type"`
	Dimension  int     `json:"dimension,omitempty"`
	StoreType  *string `json:"store_type,omitempty"`
	Format     *string `json:"format,omitempty"`
	Index      *Index  `json:"index,omitempty"`
	StoreParam *struct {
		CacheSize int `json:"cache_size,omitempty"`
	} `json:"store_param,omitempty"`
}

type FlushEntity

type FlushEntity struct {
	F      func() error
	FlushC chan error
}

type Index

type Index struct {
	Name   string          `json:"name"`
	Type   string          `json:"type,omitempty"`
	Params json.RawMessage `json:"params,omitempty"`
}

func NewDefaultIndex

func NewDefaultIndex() *Index

func (*Index) UnmarshalJSON

func (index *Index) UnmarshalJSON(bs []byte) error

type IndexParams

type IndexParams struct {
	Nlinks            int    `json:"nlinks,omitempty"`
	EfSearch          int    `json:"efSearch,omitempty"`
	EfConstruction    int    `json:"efConstruction,omitempty"`
	MetricType        string `json:"metric_type,omitempty"`
	Ncentroids        int    `json:"ncentroids,omitempty"`
	Nprobe            int    `json:"nprobe,omitempty"`
	Nsubvector        int    `json:"nsubvector,omitempty"`
	TrainingThreshold int    `json:"training_threshold,omitempty"`
}

type List added in v3.5.2

type List struct {
	Name   string   `json:"name"`
	Values []string `json:"values"`
}

type MemberInfoRequest added in v3.5.5

type MemberInfoRequest struct {
	ID   uint64 `json:"id,omitempty"`
	Name string `name:"id,omitempty"`
}

type NameType added in v3.5.2

type NameType string
const (
	RoleNameType NameType = "Role"
	UserNameType NameType = "User"
)

type NodeID

type NodeID = uint64

node id for ps

type OperatorType added in v3.5.2

type OperatorType string
const (
	Grant  OperatorType = "Grant"
	Revoke OperatorType = "Revoke"
)

type Partition

type Partition struct {
	Id                PartitionID `json:"id"`
	Name              string      `json:"name"`
	SpaceId           SpaceID     `json:"space_id"`
	DBId              DBID        `json:"db_id"`
	Slot              SlotID      `json:"partition_slot"` // Slot stores the lower limit of the slot range
	LeaderID          NodeID      `json:"leader_name,omitempty"`
	Replicas          []NodeID    `json:"replicas,omitempty"` // leader in replicas
	UpdateTime        int64       `json:"update_time,omitempty"`
	AddNum            int64       `json:"add_num,omitempty"`
	ResourceExhausted bool        `json:"resourceExhausted"`
	Path              string      `json:"-"`

	ReStatusMap map[uint64]uint32 `json:"status,omitempty"` // leader in replicas
	// contains filtered or unexported fields
}

partition/[id]:[body]

func (*Partition) GetStatus

func (p *Partition) GetStatus() PartitionStatus

this is safe method for get status

func (*Partition) SetStatus

func (p *Partition) SetStatus(s PartitionStatus)

this is safe method for set status

type PartitionForSearch

type PartitionForSearch struct {
	*Partition
	DBName, SpaceName string
}

type PartitionID

type PartitionID = uint32

PartitionID is a custom type for partition ID

type PartitionInfo

type PartitionInfo struct {
	PartitionID  PartitionID       `json:"pid"`
	Name         string            `json:"name"`
	DocNum       uint64            `json:"doc_num"`
	Size         int64             `json:"size,omitempty"`
	ReplicaNum   int               `json:"replica_num,omitempty"`
	RepStatus    map[NodeID]string `json:"replica_status,omitempty"`
	Path         string            `json:"path,omitempty"`
	Unreachable  []uint64          `json:"unreachable,omitempty"`
	Status       PartitionStatus   `json:"status,omitempty"`
	Color        string            `json:"color,omitempty"`
	Ip           string            `json:"ip,omitempty"`
	NodeID       uint64            `json:"node_id,omitempty"`
	RaftStatus   *raft.Status      `json:"raft_status,omitempty"`
	IndexStatus  int               `json:"index_status"`
	BackupStatus int               `json:"backup_status"`
	IndexNum     int               `json:"index_num"`
	MaxDocid     int               `json:"max_docid"`
	Error        string            `json:"error,omitempty"`
}

get partition from every partitions

type PartitionRule added in v3.5.2

type PartitionRule struct {
	Type       PartitionType `json:"type"`
	Field      string        `json:"field,omitempty"`
	Partitions int           `json:"partitions,omitempty"`
	Ranges     []Range       `json:"ranges,omitempty"`
}

func (*PartitionRule) AddRanges added in v3.5.2

func (pr *PartitionRule) AddRanges(ranges []Range) ([]Range, error)

func (*PartitionRule) RangeIsSame added in v3.5.2

func (pr *PartitionRule) RangeIsSame(ranges []Range) (bool, error)

func (*PartitionRule) Validate added in v3.5.2

func (pr *PartitionRule) Validate(space *Space, check_field bool) error

func (*PartitionRule) ValidateRange added in v3.5.2

func (pr *PartitionRule) ValidateRange(space *Space) error

type PartitionStatus

type PartitionStatus uint8
const (
	PA_UNKNOW PartitionStatus = iota
	PA_INVALID
	PA_CLOSED
	PA_READONLY
	PA_READWRITE
)

type PartitionType added in v3.5.2

type PartitionType string
const (
	RangePartition     PartitionType = "RANGE"
	HashPartition      PartitionType = "HASH"
	ListPartition      PartitionType = "LIST"
	KeyPartition       PartitionType = "KEY"
	CompositePartition PartitionType = "COMPOSITE"
)

type Privilege added in v3.5.2

type Privilege string
const (
	None      Privilege = "None"
	WriteOnly Privilege = "WriteOnly"
	ReadOnly  Privilege = "ReadOnly"
	WriteRead Privilege = "WriteRead"
)

type PrivilegeType added in v3.5.2

type PrivilegeType uint64

func LackPrivi

func LackPrivi(userPrivi PrivilegeType, checkPrivi PrivilegeType) PrivilegeType

type Range added in v3.5.2

type Range struct {
	Name  string `json:"name"`
	Value string `json:"value"`
}

type RecoverFailServer

type RecoverFailServer struct {
	FailNodeID   NodeID `json:"fail_node_id"`
	NewNodeID    NodeID `json:"new_node_id"`
	FailNodeAddr string `json:"fail_node_addr"`
	NewNodeAddr  string `json:"new_node_addr"`
}

RecoverFailServer use for recover fail server

type Replica

type Replica struct {
	NodeID        NodeID `json:"nodeID,omitempty"`
	HeartbeatAddr string `json:"heartbeat_addr,omitempty"`
	ReplicateAddr string `json:"replicate_addr,omitempty"`
	RpcAddr       string `json:"rpc_addr,omitempty"`
}

it use for raft add or remove node

func (*Replica) Marshal

func (m *Replica) Marshal() ([]byte, error)

func (Replica) String

func (m Replica) String() string

func (*Replica) Unmarshal

func (m *Replica) Unmarshal(dAtA []byte) error

type Resource added in v3.5.2

type Resource string
const (
	ResourceAll       Resource = "ResourceAll"
	ResourceCluster   Resource = "ResourceCluster"
	ResourceServer    Resource = "ResourceServer"
	ResourcePartition Resource = "ResourcePartition"
	ResourceDB        Resource = "ResourceDB"
	ResourceSpace     Resource = "ResourceSpace"
	ResourceDocument  Resource = "ResourceDocument"
	ResourceIndex     Resource = "ResourceIndex"
	ResourceAlias     Resource = "ResourceAlias"
	ResourceUser      Resource = "ResourceUser"
	ResourceRole      Resource = "ResourceRole"
	ResourceConfig    Resource = "ResourceConfig"
	ResourceCache     Resource = "ResourceCache"
)

type ResourceLimit added in v3.5.2

type ResourceLimit struct {
	Rate              *float64 `json:"rate,omitempty"`
	ResourceExhausted *bool    `json:"resource_exhausted,omitempty"`
	SpaceName         *string  `json:"space_name,omitempty"`
	DbName            *string  `json:"db_name,omitempty"`
}

type Role added in v3.5.2

type Role struct {
	Name       string                 `json:"name,omitempty"`
	Operator   OperatorType           `json:"operator,omitempty"`
	Privileges map[Resource]Privilege `json:"privileges,omitempty"`
}

func (*Role) HasPermissionForResources added in v3.5.2

func (role *Role) HasPermissionForResources(endpoint string, method string) error

func (*Role) Validate added in v3.5.2

func (role *Role) Validate() error

type Router added in v3.5.8

type Router struct {
	Count       float64
	LimitConfig *RouterLimitCfg
}

type RouterLimitCfg added in v3.5.8

type RouterLimitCfg struct {
	RequestLimitEnabled bool    `json:"request_limit_enabled"`
	TotalReadLimit      float64 `json:"read_request_limit_count,omitempty"`
	TotalWriteLimit     float64 `json:"write_request_limit_count,omitempty"`
}

type Server

type Server struct {
	ID                NodeID        `json:"name,omitempty"` //unique name for raft
	ResourceName      string        `toml:"resource_name,omitempty" json:"resource_name"`
	RpcPort           uint16        `json:"rpc_port"`
	RaftHeartbeatPort uint16        `json:"raft_heartbeat_port"`
	RaftReplicatePort uint16        `json:"raft_replicate_port"`
	Ip                string        `json:"ip,omitempty"`
	HostIp            string        `json:"host_ip,omitempty"`
	HostRack          string        `json:"host_rack,omitempty"`
	HostZone          string        `json:"host_zone,omitempty"`
	PartitionIds      []PartitionID `json:"p_ids,omitempty"`
	Spaces            []*Space      `json:"spaces,omitempty"`
	Size              uint64        `json:"size,omitempty"`
	Private           bool          `json:"private"`
	Version           *BuildVersion `json:"version"`
}

server/id:[body] ttl 3m 3s

func (*Server) Replica

func (s *Server) Replica() *Replica

func (*Server) RpcAddr

func (s *Server) RpcAddr() string

type SlotID

type SlotID = uint32

SlotID is a custom type for slot ID

type Space

type Space struct {
	Id                    SpaceID                     `json:"id,omitempty"`
	Desc                  string                      `json:"desc,omitempty"` // user setting
	Name                  string                      `json:"name,omitempty"` // user setting
	ResourceName          string                      `toml:"resource_name,omitempty" json:"resource_name"`
	Version               Version                     `json:"version,omitempty"`
	DBId                  DBID                        `json:"db_id,omitempty"`
	Enabled               *bool                       `json:"enabled"`    // Enabled flag whether the space can work
	Partitions            []*Partition                `json:"partitions"` // partitionids not sorted
	PartitionNum          int                         `json:"partition_num"`
	ReplicaNum            uint8                       `json:"replica_num"`
	Fields                json.RawMessage             `json:"fields"`
	Index                 *Index                      `json:"index,omitempty"`
	PartitionRule         *PartitionRule              `json:"partition_rule,omitempty"`
	SpaceProperties       map[string]*SpaceProperties `json:"space_properties,omitempty"`
	RefreshInterval       *int32                      `json:"refresh_interval,omitempty"`
	PartitionName         *string                     `json:"partition_name,omitempty"`  // partition name for partition rule
	PartitionOperatorType *string                     `json:"operator_type,omitempty"`   // partition rule operator type
	EnableIdCache         *bool                       `json:"enable_id_cache,omitempty"` // whether enable map docid to _id value in cache
}

space/[dbId]/[spaceId]:[spaceBody]

func (*Space) GetPartition

func (s *Space) GetPartition(id PartitionID) *Partition

func (*Space) PartitionId

func (s *Space) PartitionId(slotID SlotID) PartitionID

func (*Space) PartitionIdsByRangeField added in v3.5.2

func (s *Space) PartitionIdsByRangeField(value []byte, field_type vearchpb.FieldType) ([]PartitionID, error)

func (*Space) String

func (s *Space) String() string

func (*Space) Validate

func (space *Space) Validate() error

check params is ok

type SpaceConfig added in v3.5.8

type SpaceConfig struct {
	Id              SpaceID `json:"id,omitempty"`
	DBId            DBID    `json:"db_id,omitempty"`
	EngineCacheSize *int64  `json:"engine_cache_size,omitempty"`
	Path            *string `json:"path,omitempty"`
	LongSearchTime  *int64  `json:"long_search_time,omitempty"`
	RefreshInterval *int32  `json:"refresh_interval,omitempty"`
	EnableIdCache   *bool   `json:"enable_id_cache,omitempty"`
}

TODO separete space config and mapping space_config/[dbId]/[spaceId]:[spaceConfigBody]

type SpaceID

type SpaceID = int64

SpaceID is a custom type for space ID

type SpaceInfo

type SpaceInfo struct {
	SpaceName     string           `json:"space_name,omitempty"`
	Name          string           `json:"name,omitempty"` // for compitable with old version before v3.5.5, cluster health api use it
	DbName        string           `json:"db_name"`
	DocNum        uint64           `json:"doc_num"`
	PartitionNum  int              `json:"partition_num"`
	ReplicaNum    uint8            `json:"replica_num"`
	Schema        *SpaceSchema     `json:"schema"`
	PartitionRule *PartitionRule   `json:"partition_rule,omitempty"`
	Status        string           `json:"status,omitempty"`
	Partitions    []*PartitionInfo `json:"partitions"`
	Errors        []string         `json:"errors,omitempty"`
}

type SpaceProperties

type SpaceProperties struct {
	FieldType  vearchpb.FieldType   `json:"field_type"`
	Type       string               `json:"type"`
	Index      *Index               `json:"index,omitempty"`
	Format     *string              `json:"format,omitempty"`
	Dimension  int                  `json:"dimension,omitempty"`
	StoreType  *string              `json:"store_type,omitempty"`
	StoreParam json.RawMessage      `json:"store_param,omitempty"`
	Option     vearchpb.FieldOption `json:"option,omitempty"`
}

type SpaceSchema

type SpaceSchema struct {
	Fields json.RawMessage `json:"fields"`
	Index  *Index          `json:"index,omitempty"`
}

type User

type User struct {
	Name        string  `json:"name"`
	Password    *string `json:"password,omitempty"`
	OldPassword *string `json:"old_password,omitempty"`
	RoleName    *string `json:"role_name,omitempty"`
}

func (*User) Validate added in v3.5.2

func (user *User) Validate(check_root bool) error

type UserRole added in v3.5.2

type UserRole struct {
	Name        string  `json:"name"`
	Password    *string `json:"password,omitempty"`
	OldPassword *string `json:"old_password,omitempty"`
	Role        Role    `json:"role,omitempty"`
}

type Version

type Version = uint64

Version is a custom type for Partition

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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