go-vitess.v1: gopkg.in/src-d/go-vitess.v1/vt/vttablet/tabletserver/txlimiter Index | Files

package txlimiter

import "gopkg.in/src-d/go-vitess.v1/vt/vttablet/tabletserver/txlimiter"

Index

Package Files

tx_limiter.go

type Impl Uses

type Impl struct {
    // contains filtered or unexported fields
}

Impl limits the total number of transactions a single user may use concurrently. Implements TxLimiter.

func (*Impl) Get Uses

func (txl *Impl) Get(immediate *querypb.VTGateCallerID, effective *vtrpcpb.CallerID) bool

Get tells whether given user (identified by context.Context) is allowed to use another transaction slot. If this method returns true, it's necessary to call Release once transaction is returned to the pool. Implements TxLimiter.Get

func (*Impl) Release Uses

func (txl *Impl) Release(immediate *querypb.VTGateCallerID, effective *vtrpcpb.CallerID)

Release marks that given user (identified by caller ID) is no longer using a transaction slot. Implements TxLimiter.Release

type TxAllowAll Uses

type TxAllowAll struct{}

TxAllowAll is a TxLimiter that allows all Get requests and does no tracking. Implements Txlimiter.

func (*TxAllowAll) Get Uses

func (txa *TxAllowAll) Get(immediate *querypb.VTGateCallerID, effective *vtrpcpb.CallerID) bool

Get always returns true (allows all requests). Implements TxLimiter.Get

func (*TxAllowAll) Release Uses

func (txa *TxAllowAll) Release(immediate *querypb.VTGateCallerID, effective *vtrpcpb.CallerID)

Release is noop, because TxAllowAll does no tracking. Implements TxLimiter.Release

type TxLimiter Uses

type TxLimiter interface {
    Get(immediate *querypb.VTGateCallerID, effective *vtrpcpb.CallerID) bool
    Release(immediate *querypb.VTGateCallerID, effective *vtrpcpb.CallerID)
}

TxLimiter is the transaction limiter interface.

func New Uses

func New(slotCount int, maxPerUser float64, enabled, dryRun, byUsername, byPrincipal, byComponent, bySubcomponent bool) TxLimiter

New creates a new TxLimiter. slotCount: total slot count in transaction pool maxPerUser: fraction of the pool that may be taken by single user enabled: should the feature be enabled. If false, will return "allow-all" limiter dryRun: if true, does no limiting, but records stats of the decisions made byXXX: whether given field from immediate/effective caller id should be taken into account when deciding "user" identity for purposes of transaction limiting.

Package txlimiter imports 7 packages (graph) and is imported by 1 packages. Updated 2019-06-13. Refresh now. Tools for package owners.