Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( RateLimitRequests = promauto.NewCounterVec( prometheus.CounterOpts{ Name: "gopher_guard_requests_total", Help: "Total number of rate limit requests processed by Gopher-Guard", }, []string{"status"}, ) TotalGRPCRequest = promauto.NewCounterVec( prometheus.CounterOpts{ Name: "grpc_requests_total", Help: "Total no of grpc requests achieved", }, []string{"method"}, ) RaftCurrentTerm = promauto.NewGauge( prometheus.GaugeOpts{ Name: "raft_current_term", Help: "The current raft term(increments on elections)", }, ) RaftIsLeader = promauto.NewGauge( prometheus.GaugeOpts{ Name: "raft_is_leader", Help: "Returns 1 if the node is the leader otherwise 0", }, ) )
Functions ¶
This section is empty.
Types ¶
type CommandType ¶
type CommandType string
const ( CommandAddTimestamp CommandType = "ADD_TIMESTAMP" CommandDeleteKey CommandType = "DELETE_KEY" )
type LimiterFSM ¶
type LimiterFSM struct {
Engine *SlidingWindow
}
func (*LimiterFSM) Apply ¶
func (f *LimiterFSM) Apply(logEntry *raft.Log) interface{}
func (*LimiterFSM) Restore ¶
func (f *LimiterFSM) Restore(rc io.ReadCloser) error
func (*LimiterFSM) Snapshot ¶
func (f *LimiterFSM) Snapshot() (raft.FSMSnapshot, error)
type LogCommand ¶
type LogCommand struct {
Type CommandType `json:"type"`
Key string `json:"key"`
Timestamp time.Time `json:"timestamp"`
}
func DecodeCommand ¶
func DecodeCommand(data []byte) (*LogCommand, error)
func (*LogCommand) Encode ¶
func (lg *LogCommand) Encode() ([]byte, error)
type SlidingWindow ¶
func NewSlidingWindow ¶
func NewSlidingWindow() *SlidingWindow
func (*SlidingWindow) StartJanitor ¶
func (sw *SlidingWindow) StartJanitor(interval time.Duration, maxWindow time.Duration)
Click to show internal directories.
Click to hide internal directories.