Documentation
¶
Index ¶
- Variables
- func MatchRule(cfg config.Config, path []byte) *config.Rule
- type Entry
- func EntryFromBytes(data []byte, cfg config.Config) (*Entry, error)
- func NewEntryFastHttp(cfg config.Config, r *fasthttp.RequestCtx) (*Entry, error)
- func NewEntryFromField(key uint64, shard uint64, fingerprint [16]byte, payload []byte, ...) *Entry
- func NewEntryNetHttp(rule *config.Rule, r *http.Request) *Entry
- func NewMockEntry(cfg config.Config, req *fasthttp.Request, resp *fasthttp.Response) (*Entry, error)
- func (e *Entry) DumpBuffer(r *fasthttp.RequestCtx)
- func (e *Entry) DumpPayload()
- func (e *Entry) Fingerprint() [16]byte
- func (e *Entry) GetFilteredAndSortedKeyHeadersNetHttp(r *http.Request) (kvPairs *[][2][]byte, releaseFn func(*[][2][]byte))
- func (e *Entry) GetFilteredAndSortedKeyQueriesNetHttp(r *http.Request) (kvPairs *[][2][]byte, releaseFn func(*[][2][]byte))
- func (e *Entry) Init() *Entry
- func (e *Entry) IsSameEntry(another *Entry) bool
- func (e *Entry) IsSameFingerprint(another [16]byte) bool
- func (e *Entry) IsSamePayload(another *Entry) bool
- func (e *Entry) LruListElement() *list.Element[*Entry]
- func (e *Entry) MapKey() uint64
- func (e *Entry) Payload() (req *fasthttp.Request, resp *fasthttp.Response, ...)
- func (e *Entry) PayloadBytes() []byte
- func (e *Entry) Rule() *config.Rule
- func (e *Entry) SetLruListElement(el *list.Element[*Entry])
- func (e *Entry) SetMapKey(key uint64) *Entry
- func (e *Entry) SetPayload(req *fasthttp.Request, resp *fasthttp.Response) *Entry
- func (e *Entry) ShardKey() uint64
- func (e *Entry) ShouldBeRefreshed(cfg config.Config) bool
- func (e *Entry) SwapPayloads(another *Entry)
- func (e *Entry) ToBytes() (data []byte, releaseFn func())
- func (e *Entry) UpdateAt() int64
- func (e *Entry) Weight() int64
- type Releaser
Constants ¶
This section is empty.
Variables ¶
var ErrPayloadIsEmpty = fmt.Errorf("payload is empty")
Functions ¶
Types ¶
type Entry ¶ added in v0.9.3
type Entry struct {
// contains filtered or unexported fields
}
Entry is the packed request+response payload
func EntryFromBytes ¶ added in v0.9.3
func NewEntryFastHttp ¶ added in v0.9.3
NewEntryFastHttp accepts path, query and request headers as bytes slices.
func NewEntryFromField ¶ added in v0.9.3
func NewEntryNetHttp ¶ added in v0.9.3
NewEntryNetHttp accepts path, query and request headers as bytes slices.
func NewMockEntry ¶ added in v1.1.1
func (*Entry) DumpBuffer ¶ added in v1.0.1
func (e *Entry) DumpBuffer(r *fasthttp.RequestCtx)
func (*Entry) DumpPayload ¶ added in v0.9.3
func (e *Entry) DumpPayload()
func (*Entry) Fingerprint ¶ added in v0.9.3
func (*Entry) GetFilteredAndSortedKeyHeadersNetHttp ¶ added in v0.9.3
func (*Entry) GetFilteredAndSortedKeyQueriesNetHttp ¶ added in v0.9.3
func (*Entry) IsSameEntry ¶ added in v0.9.5
func (*Entry) IsSameFingerprint ¶ added in v0.9.3
func (*Entry) IsSamePayload ¶ added in v1.0.1
func (*Entry) LruListElement ¶ added in v0.9.3
LruListElement returns the LRU list element pointer (for LRU cache management).
func (*Entry) Payload ¶ added in v0.9.3
func (e *Entry) Payload() (req *fasthttp.Request, resp *fasthttp.Response, releaser func(*fasthttp.Request, *fasthttp.Response), err error)
Payload decompresses the entire payload and unpacks it into fields.
func (*Entry) PayloadBytes ¶ added in v0.9.3
func (*Entry) SetLruListElement ¶ added in v0.9.3
SetLruListElement sets the LRU list element pointer.
func (*Entry) SetMapKey ¶ added in v0.9.3
SetMapKey is really dangerous - must be used exclusively in tests.
func (*Entry) SetPayload ¶ added in v0.9.3
SetPayload packs and gzip-compresses the entire payload: Path, Query, QueryHeaders, StatusCode, ResponseHeaders, Body.
func (*Entry) ShouldBeRefreshed ¶ added in v0.9.3
ShouldBeRefreshed implements probabilistic refresh logic ("beta" algorithm). Returns true if the entry is stale and, with a probability proportional to its staleness, should be refreshed now.