rpc

package
v2.9.0+incompatible Latest Latest
Warning

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

Go to latest
Published: Oct 10, 2019 License: MPL-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ClientSingletonCall     = "gorpcClientCall"
	FuncClientSingletonCall = "gorpcDispatcherClientCall"
)

Variables

View Source
var (
	GlobalRPCCallTimeout = 30 * time.Second
	GlobalRPCPingTimeout = 60 * time.Second
	Log                  = &logrus.Logger{}
	Instrument           *health.Stream
)

Functions

func Connect

func Connect(connConfig Config, suppressRegister bool, dispatcherFuncs map[string]interface{},
	getGroupLoginFunc func(string, string) interface{},
	emergencyModeFunc func(),
	emergencyModeLoadedFunc func()) bool

Connect will establish a connection to the RPC server specified in connection options

func Disconnect

func Disconnect() bool

func EmitErrorEvent

func EmitErrorEvent(jobName string, funcName string, err error)

func EmitErrorEventKv

func EmitErrorEventKv(jobName string, funcName string, err error, kv map[string]string)

func FuncClientSingleton

func FuncClientSingleton(funcName string, request interface{}) (interface{}, error)

func GroupLogin

func GroupLogin() bool

func IsEmergencyMode

func IsEmergencyMode() bool

func LoadCount

func LoadCount() int

func Login

func Login() bool

func Reset

func Reset()

func ResetEmergencyMode

func ResetEmergencyMode()

Types

type AnalyticsRecord

type AnalyticsRecord struct {
	Method        string
	Path          string
	RawPath       string
	ContentLength int64
	UserAgent     string
	Day           int
	Month         time.Month
	Year          int
	Hour          int
	ResponseCode  int
	APIKey        string
	TimeStamp     time.Time
	APIVersion    string
	APIName       string
	APIID         string
	OrgID         string
	OauthID       string
	RequestTime   int64
	RawRequest    string
	RawResponse   string
	IPAddress     string
	Geo           GeoData
	Tags          []string
	Alias         string
	TrackPath     bool
	ExpireAt      time.Time `bson:"expireAt" json:"expireAt"`
}

type Config

type Config struct {
	UseSSL                bool   `json:"use_ssl"`
	SSLInsecureSkipVerify bool   `json:"ssl_insecure_skip_verify"`
	ConnectionString      string `json:"connection_string"`
	RPCKey                string `json:"rpc_key"`
	APIKey                string `json:"api_key"`
	GroupID               string `json:"group_id"`
	CallTimeout           int    `json:"call_timeout"`
	PingTimeout           int    `json:"ping_timeout"`
	RPCPoolSize           int    `json:"rpc_pool_size"`
}

type GeoData

type GeoData struct {
	Country struct {
		ISOCode string `maxminddb:"iso_code"`
	} `maxminddb:"country"`

	City struct {
		GeoNameID uint              `maxminddb:"geoname_id"`
		Names     map[string]string `maxminddb:"names"`
	} `maxminddb:"city"`

	Location struct {
		Latitude  float64 `maxminddb:"latitude"`
		Longitude float64 `maxminddb:"longitude"`
		TimeZone  string  `maxminddb:"time_zone"`
	} `maxminddb:"location"`
}

type Purger

type Purger struct {
	Store storage.Handler
}

RPCPurger will purge analytics data into a Mongo database, requires that the Mongo DB string is specified in the Config object

func (*Purger) Connect

func (r *Purger) Connect()

Connect Connects to RPC

func (*Purger) PurgeCache

func (r *Purger) PurgeCache()

PurgeCache will pull the data from the in-memory store and drop it into the specified MongoDB collection

func (Purger) PurgeLoop

func (r Purger) PurgeLoop(ticker <-chan time.Time)

PurgeLoop starts the loop that will pull data out of the in-memory store and into RPC.

Jump to

Keyboard shortcuts

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