ratelimit

package
v1.2.5 Latest Latest
Warning

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

Go to latest
Published: Sep 18, 2024 License: Apache-2.0 Imports: 1 Imported by: 0

README

ratelimit

import "github.com/ccheers/xpkg/ratelimit"

Index

type Allow

Allow allow options.

type Allow struct{}
func DefaultAllowOpts
func DefaultAllowOpts() Allow

DefaultAllowOpts returns the default allow options.

type AllowOption

AllowOption some option of Allow

type AllowOption interface {
    Apply(*Allow)
}

type DoneInfo

DoneInfo done info.

type DoneInfo struct {
    Err error
    Op  Op
}

type Limiter

Limiter limit interface.

type Limiter interface {
    Allow(ctx context.Context, opts ...AllowOption) (func(info DoneInfo), error)
}

type Op

Op operations type.

type Op int
const (
    // Success opertion type: success
    Success Op  = iota
    // Ignore opertion type: ignore
    Ignore
    // Drop opertion type: drop
    Drop
)

Generated by gomarkdoc

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Allow

type Allow struct{}

Allow allow options.

func DefaultAllowOpts

func DefaultAllowOpts() Allow

DefaultAllowOpts returns the default allow options.

type AllowOption

type AllowOption interface {
	Apply(*Allow)
}

AllowOption some option of Allow

type DoneInfo

type DoneInfo struct {
	Err error
	Op  Op
}

DoneInfo done info.

type Limiter

type Limiter interface {
	Allow(ctx context.Context, opts ...AllowOption) (func(info DoneInfo), error)
}

Limiter limit interface.

type Op

type Op int

Op operations type.

const (
	// Success opertion type: success
	Success Op = iota
	// Ignore opertion type: ignore
	Ignore
	// Drop opertion type: drop
	Drop
)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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