Documentation ¶
Overview ¶
Package doorman is a client library for Doorman, a global, distributed, client side rate limitting service.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ( // ErrDuplicateResourceID is an error indicating the requested // resource was already claimed from this client. ErrDuplicateResourceID = errors.New("duplicate resource ID") // ErrInvalidWants indicates that wants must be a postive number > 0 ErrInvalidWants = errors.New("wants must be > 0.0") )
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client is a Doorman client.
func New ¶
New creates a new client connected to server available at addr. It will use the hostname to generate a client id. If you need finer control over the client's id, use NewWithID.
func NewWithID ¶
NewWithID creates a new client connected to server available at addr, identifying using the custom id provided.
type Option ¶
type Option connection.Option
Option configures the client's connection parameters.
func DialOpts ¶
func DialOpts(dialOpts ...rpc.DialOption) Option
DialOpts sets dial options for the client's connection with the server.
func MinimumRefreshInterval ¶
MinimumRefreshInterval sets the minimum refresh interval for establishing the client's connection with the server.
type Resource ¶
type Resource interface { // Capacity returns a channel on which the available capacity // will be sent. Capacity() chan float64 // Ask requests a new capacity for this resource. If the resource // was already released this call has no effect. Ask(float64) error // Release releases any capacity held by this client. Release() error }
Resource represents a resource managed by a doorman server.