common

package
v0.0.0-...-b988991 Latest Latest
Warning

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

Go to latest
Published: Apr 16, 2024 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ConsulServName          string = "SailCraft-IndexSvr"
	ConsulHealthCheckUrlFmt string = "http://%s:%d/IndexSvr/healthCheck"
)
View Source
const (
	HTTP_METHOD_GET  = 1
	HTTP_METHOD_POST = 2
	HTTP_METHOD_PUT  = 4
)
View Source
const (
	QUERYTYPE_LIKE  = "like"
	QUERYTYPE_MATCH = "match"
)

Variables

View Source
var (
	ConsulServInstanceID string
	ConsulClient         *api.Client
)
View Source
var (
	GServName           string
	GServListenIP       string
	GServListenCtrlPort int
)

Functions

func IndexSvrSync

func IndexSvrSync(indexSvrIPs []string, interfaceName string, req *base.ProtoRequestS)

func LoadConfig

func LoadConfig(configFile, localAddr string) error

func RegisterToConsul

func RegisterToConsul(listenIP string, listenPort int, consulServerIP string, healthCheckPort int) error

func SendResponse

func SendResponse(c *gin.Context, res *base.ProtoResponseS)

func UnpackRequest

func UnpackRequest(c *gin.Context) *base.ProtoRequestS

Types

type IndexSvrConfigS

type IndexSvrConfigS struct {
	RedisAddressLst []string  `json:"RedisAddressLst"`
	BucketCount     int       `json"BucketCount"`
	Auth            string    `json:"Auth"`
	GuildInfo       RedisKeyS `json:"GuildInfo"`
	UserInfo        RedisKeyS `json:"UserInfo"`
	IndexSvrCluster []string  `json:"IndexSvrCluster"`
	DirtyWordFile   string    `json:"DirtyWordFile"`
}
var (
	GConfig *IndexSvrConfigS = nil
)

type RedisKeyS

type RedisKeyS struct {
	Keys     []string `json:"Keys"`
	KeyMatch string   `json:"KeyMatch"`
}

Jump to

Keyboard shortcuts

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