model

package
v0.0.0-...-83adff0 Latest Latest
Warning

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

Go to latest
Published: Jul 6, 2020 License: GPL-3.0 Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AddClusterReq

type AddClusterReq struct {
	ID               int64  `json:"id" form:"id"`                                                // 主键id 更新的时候使用
	Type             string `json:"type" form:"type" validate:"required"`                        // 缓存类型(memcache,redis,redis_cluster)
	AppID            string `json:"app_id" form:"app_id"`                                        // 集群关联的appid
	Zone             string `json:"zone" form:"zone"`                                            // 机房
	HashMethod       string `json:"hash_method" form:"hash_method" default:"fnv1a_64"`           // 哈希方法  默认fvn1a_64
	HashDistribution string `json:"hash_distribution" form:"hash_distribution" default:"ketama"` // key分布策略 默认为ketama一致性hash
	HashTag          string `json:"hash_tag" form:"hash_tag"`                                    // key hash 标识
	Name             string `json:"name" form:"name" validate:"required"`                        // 集群名字
	DailTimeout      int32  `json:"dail_timeout" form:"dail_timeout" default:"100"`              // dial 超时
	ReadTimeout      int32  `json:"read_timeout" form:"read_timeout" default:"100"`              // read 超时
	WriteTimeout     int32  `json:"write_timeout" form:"write_timeout" default:"100"`            // write 超时
	NodeConn         int8   `json:"node_conn" form:"node_conn" default:"10"`                     // 集群内及诶单连接数
	PingFailLimit    int32  `json:"ping_fail_limit" form:"ping_fail_limit"`                      // 节点失败检测次数
	PingAutoEject    bool   `json:"ping_auto_eject" form:"ping_auto_eject"`                      // 是否自动剔除节点
	ListenProto      string `json:"listen_proto" form:"listen_proto" default:"tcp"`              // 协议
	ListenAddr       string `json:"listen_addr" form:"listen_addr"`                              // 监听地址
}

AddClusterReq params of add a cluster.

type CacheData

type CacheData struct {
	Data  map[int64]*RoleNode `json:"data"`
	CTime time.Time           `json:"ctime"`
}

CacheData ...

type Cluster

type Cluster struct {
	ID               int64    `gorm:"column:id" json:"id" toml:"id"`
	Name             string   `json:"name" gorm:"column:name" toml:"name"`       // 集群名字
	Type             string   `json:"type" gorm:"column:type" toml:"cache_type"` // 缓存类型. (memcache,redis,redis-cluster)
	AppID            string   `json:"app_id" gorm:"column:appids" toml:"app_id"`
	Zone             string   `json:"zone" gorm:"column:zone" toml:"zone"`                                        // 机房
	HashMethod       string   `json:"hash_method" gorm:"column:hash_method" toml:"hash_method"`                   // 哈希方法  默认sha1
	HashDistribution string   `json:"hash_distribution" gorm:"column:hash_distribution" toml:"hash_distribution"` // key分布策略 默认为ketama一致性hash
	HashTag          string   `json:"hash_tag" gorm:"column:hashtag" toml:"hash_tag"`                             // key hash 标识
	DailTimeout      int32    `json:"dail_timeout" gorm:"column:dial" toml:"dail_timeout"`                        // dial 超时
	ReadTimeout      int32    `json:"read_timeout" gorm:"column:read" toml:"read_timeout"`
	WriteTimeout     int32    `json:"write_timeout" gorm:"column:write" toml:"write_timeout"`               // read 超时
	NodeConn         int8     `json:"node_conn" gorm:"column:nodeconn" toml:"node_connections"`             // 集群内节点连接数
	PingFailLimit    int32    `json:"ping_fail_limit" gorm:"column:ping_fail_limit" toml:"ping_fail_limit"` // 节点失败检测次数
	PingAutoEject    bool     `json:"ping_auto_eject" gorm:"column:auto_eject" toml:"ping_auto_eject"`      // 是否自动剔除节点
	ListenProto      string   `json:"listen_proto" toml:"listen_proto"`
	ListenAddr       string   `json:"listen_addr" toml:"listen_addr"`
	Servers          []string `json:"-" gorm:"-" toml:"servers"`

	Hit      int `json:"hit" gorm:"-" toml:"-"`       // 集群命中率
	QPS      int `json:"qps" gorm:"-" toml:"-"`       // 集群qps
	State    int `json:"state" gorm:"-" toml:"-"`     // 集群状态 (0-online ;1-offline)
	MemRatio int `json:"mem_ratio" gorm:"-" toml:"-"` // 内存使用率

	Nodes []NodeDtl `json:"nodes" gorm:"-" toml:"-"`
}

Cluster resp result of clusters.

func (*Cluster) TableName

func (*Cluster) TableName() string

TableName gorm table name.

type ClusterDtlReq

type ClusterDtlReq struct {
	ID int64 `json:"id" form:"id"` // 集群id
}

ClusterDtlReq params of get cluster detail.

type ClusterDtlResp

type ClusterDtlResp struct {
	Nodes []NodeDtl `json:"nodes"`
}

ClusterDtlResp resp result of cluster detail.

type ClusterFromYml

type ClusterFromYml struct {
	AppID string `json:"app_id" form:"app_id"` // 关联的appid
	Zone  string `json:"zone" form:"zone"`     // 机房信息
	TwYml string `json:"tw_yml" form:"tw_yml"`
}

ClusterFromYml get cluster from tw yml.

type ClusterReq

type ClusterReq struct {
	AppID string `json:"app_id" form:"app_id"` // 关联的appid
	Zone  string `json:"zone" form:"zone"`     // 机房信息
	Type  string `json:"type" form:"type"`     // 缓存类型
	PN    int    `form:"pn"  default:"1"`
	PS    int    `form:"ps"  default:"20"`
	//	Cluster string `json:"cluster" form:"cluster"` // 集群名字
	Cookie string `form:"-"`
}

ClusterReq get cluster by appid or cluster name.

type ClusterResp

type ClusterResp struct {
	Clusters []*Cluster `json:"clusters"`
	Total    int64      `json:"total"` // 总数量
}

ClusterResp resp result of clusters.

type ClustersReq

type ClustersReq struct {
	PN int `form:"pn"  default:"1"`
	PS int `form:"ps"  default:"20"`
}

ClustersReq params of cluster list.

type DelClusterReq

type DelClusterReq struct {
	ID int64 `form:"id"` // 集群主键id
}

DelClusterReq params of del cluster.

type EmpResp

type EmpResp struct {
}

EmpResp is empty resp.

type ModifyClusterReq

type ModifyClusterReq struct {
	Name   string `json:"name" form:"name"`
	ID     int64  `json:"id" form:"id"`         // 集群id
	Action int8   `json:"action" form:"action"` // 操作(1 添加节点,2 删除节点;删除节点时只需要传alias)
	Nodes  string `json:"nodes" form:"nodes"`   // 节点信息 json数组 [{"id":11,"addr":"11","weight":1,"alias":"alias"}]

}

ModifyClusterReq params of modify cluster detail.

type Node

type Node struct {
	Name   string `json:"name"`
	Path   string `json:"path"`
	TreeID int64  `json:"tree_id"`
}

Node node.

type NodeDtl

type NodeDtl struct {
	ID      int64   `json:"id" gorm:"column:id"`
	Cid     int64   `json:"cid" gorm:"column:cid"`
	Addr    string  `json:"addr" gorm:"column:addr"`
	Weight  int8    `json:"weight" gorm:"column:weight"`
	Alias   string  `json:"alias" gorm:"column:alias"`
	State   int8    `json:"state" gorm:"column:state"`
	QPS     int64   `json:"qps" gorm:"-"`
	MemUse  float32 `json:"mem_use" gorm:"-"`
	MemToal float32 `json:"mem_toal" gorm:"-"`
}

NodeDtl cluster node detaiwl

func (*NodeDtl) TableName

func (*NodeDtl) TableName() string

TableName gorm table name.

type OpsCacheMemcache

type OpsCacheMemcache struct {
	Labels struct {
		Name    string `json:"name"`
		Project string `json:"project"`
	}
	Targets []string `json:"targets"`
}

OpsCacheMemcache ops cache mc

type OpsCacheRedis

type OpsCacheRedis struct {
	Labels struct {
		Name    string `json:"name"`
		Project string `json:"project"`
	}
	Type    string   `json:"type"`
	Targets []string `json:"master_targets"`
}

OpsCacheRedis ops cache redis

type OverlordApiserver

type OverlordApiserver struct {
	Group    string `json:"group"`
	Clusters []struct {
		Name string `json:"name"`
		Type string `json:"cache_type"`
		// HashMethod       string   `json:"hash_method"`
		// HashDistribution string   `json:"hash_distribution"`
		// HashTag          string   `json:"hash_tag"`
		// DailTimeout      int32    `json:"dail_timeout"`
		// ReadTimeout      int32    `json:"read_timeout"`
		// WriteTimeout     int32    `json:"write_timeout"`
		// NodeConn         int8     `json:"node_connections"`
		// PingFailLimit    int32    `json:"ping_fail_limit"`
		// PingAutoEject    bool     `json:"ping_auto_eject"`
		FrontEndPort int `json:"front_end_port"`

		Instances []struct {
			IP     string `json:"ip"`
			Port   int    `json:"port"`
			Weight int8   `json:"weight"`
			Alias  string `json:"alias"`
			State  string `json:"state"`
			Role   string `json:"role"`
		} `json:"instances"`
	} `json:"clusters"`
}

OverlordApiserver resp result of clusters.

type OverlordApp

type OverlordApp struct {
	ID     int64  `json:"-" gorm:"column:id"`
	TreeID int64  `json:"treeid" gorm:"column:tree_id"`
	AppID  string `json:"appid" gorm:"column:app_id"`
	Cid    int64  `json:"cid" gorm:"column:cid"`

	Cluster *OverlordCluster `json:"cluster,omitempty"`
}

OverlordApp .

func (*OverlordApp) TableName

func (*OverlordApp) TableName() string

TableName gorm table name.

type OverlordCluster

type OverlordCluster struct {
	ID               int64  `json:"id" gorm:"column:id"`
	Name             string `json:"name" gorm:"column:name"`                           // 集群名字
	Type             string `json:"type" gorm:"column:type"`                           // 缓存类型. (memcache,redis,redis-cluster)
	Zone             string `json:"zone" gorm:"column:zone"`                           // 机房
	HashMethod       string `json:"hash_method" gorm:"column:hash_method"`             // 哈希方法  默认sha1
	HashDistribution string `json:"hash_distribution" gorm:"column:hash_distribution"` // key分布策略 默认为ketama一致性hash
	HashTag          string `json:"hash_tag" gorm:"column:hashtag"`                    // key hash 标识
	ListenProto      string `json:"listen_proto" gorm:"column:listen_proto"`
	ListenAddr       string `json:"listen_addr" gorm:"column:listen_addr"`
	DailTimeout      int32  `json:"dail_timeout" gorm:"column:dial"`               // dial 超时
	ReadTimeout      int32  `json:"read_timeout" gorm:"column:read"`               // read 超时
	WriteTimeout     int32  `json:"write_timeout" gorm:"column:write"`             // write 超时
	NodeConn         int8   `json:"node_conn" gorm:"column:nodeconn"`              // 集群内节点连接数
	PingFailLimit    int32  `json:"ping_fail_limit" gorm:"column:ping_fail_limit"` // 节点失败检测次数
	PingAutoEject    bool   `json:"ping_auto_eject" gorm:"column:auto_eject"`      // 是否自动剔除节点

	Nodes []*OverlordNode `json:"nodes" gorm:"-"`
}

OverlordCluster .

func (*OverlordCluster) TableName

func (*OverlordCluster) TableName() string

TableName gorm table name.

type OverlordNode

type OverlordNode struct {
	Cid    int64  `json:"cid" gorm:"column:cid"`
	Alias  string `json:"alias" gorm:"column:alias"`
	Addr   string `json:"addr" gorm:"column:addr"`
	Weight int8   `json:"weight" gorm:"column:weight"`
}

OverlordNode .

func (*OverlordNode) TableName

func (*OverlordNode) TableName() string

TableName gorm table name.

type OverlordReq

type OverlordReq struct {
	Name  string `json:"name" form:"name"`
	Zone  string `json:"zone" form:"zone"`
	Type  string `json:"type" form:"type"`
	Alias string `json:"alias" form:"alias"`
	Addr  string `json:"addr" form:"addr"`
	AppID string `json:"appid" form:"appid"`

	PN int `form:"pn"  default:"1"`
	PS int `form:"ps"  default:"20"`

	Cookie string `json:"-"`
}

OverlordReq .

type OverlordResp

type OverlordResp struct {
	Names    []string           `json:"names,omitempty"`
	Addrs    []string           `json:"addrs,omitempty"`
	Cluster  *OverlordCluster   `json:"cluster,omitempty"`
	Clusters []*OverlordCluster `json:"clusters,omitempty"`
	Total    int64              `json:"total"`
	Nodes    []*OverlordNode    `json:"nodes,omitempty"`
	Apps     []*OverlordApp     `json:"apps,omitempty"`
	AppIDs   []string           `json:"appids,omitempty"`
}

OverlordResp .

type OverlordToml

type OverlordToml struct {
	Name             string   `toml:"name"`
	Type             string   `toml:"cache_type"`
	HashMethod       string   `toml:"hash_method"`
	HashDistribution string   `toml:"hash_distribution"`
	HashTag          string   `toml:"hash_tag"`
	DailTimeout      int32    `toml:"dail_timeout"`
	ReadTimeout      int32    `toml:"read_timeout"`
	WriteTimeout     int32    `toml:"write_timeout"`
	NodeConn         int8     `toml:"node_connections"`
	PingFailLimit    int32    `toml:"ping_fail_limit"`
	PingAutoEject    bool     `toml:"ping_auto_eject"`
	ListenProto      string   `toml:"listen_proto"`
	ListenAddr       string   `toml:"listen_addr"`
	Servers          []string `toml:"servers"`
}

OverlordToml resp result of clusters.

type Res

type Res struct {
	Count   int         `json:"count"`
	Data    []*TreeNode `json:"data"`
	Page    int         `json:"page"`
	Results int         `json:"results"`
}

Res res.

type RoleNode

type RoleNode struct {
	ID   int64  `json:"id"`
	Name string `json:"name"`
	Path string `json:"path"`
	Type int8   `json:"type"`
	Role int8   `json:"role"`
}

RoleNode roleNode .

type TreeNode

type TreeNode struct {
	Alias     string      `json:"alias"`
	CreatedAt string      `json:"created_at"`
	Name      string      `json:"name"`
	Path      string      `json:"path"`
	Tags      interface{} `json:"tags"`
	Type      int         `json:"type"`
}

TreeNode TreeNode.

Jump to

Keyboard shortcuts

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