Documentation ¶
Overview ¶
Package serverutil provides helper functions for Upspin servers.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Glob ¶
Glob executes a DirServer.Glob operation for the specified pattern using the provided LookupFunc and ListFunc to retrieve data.
func IsLoopback ¶
IsLoopback returns true if the name only resolves to loopback addresses.
Types ¶
type ListFunc ¶
ListFunc lists the entries in the directory specified by path. It should handle access control internally, returning a Private or Permission error if the caller does not have access. It should return an ErrFollowLink error iff the given path name is a link. In that one case, it should also return only the DirEntry for that path.
type LookupFunc ¶
LookupFunc is a DirServer.Lookup implementation.
type RateCounter ¶
type RateCounter struct {
// contains filtered or unexported fields
}
RateCounter is a counter that tracks how many values have been added per unit of time, averaged over a certain period. RateCounter is an expvar and thus can be used to count time-based events such as requests per second.
func NewRateCounter ¶
func NewRateCounter(samples int, d time.Duration) *RateCounter
NewRateCounter creates a new counter that reports how many values have been added per unit of time, averaged over a rolling window with a given number of samples. For example, to measure unit per second averaged over the last sixty one-second samples: NewRateCount(60, time.Second).
func (*RateCounter) Rate ¶
func (r *RateCounter) Rate() float64
Rate returns the rate that values are Added to the counter, per unit of time, averaged over the number of buckets.
type RateLimiter ¶
type RateLimiter struct { // Backoff specifies an initial backoff duration for a key. // After the first request for a given key the key will be denied until // the backoff has passed. If another request arrives after the backoff // but before Max, the backoff duration is doubled. Backoff time.Duration // Max specifies a maximum backoff duration. Max time.Duration // contains filtered or unexported fields }
RateLimiter implements a rate limiter with exponential backoff, up to a specified maximum.
Directories ¶
Path | Synopsis |
---|---|
Dirserver is a wrapper for a directory implementation that presents it as an HTTP interface.
|
Dirserver is a wrapper for a directory implementation that presents it as an HTTP interface. |
Package frontend provides a web server that serves documentation and meta tags to instruct "go get" where to find the Upspin source repository.
|
Package frontend provides a web server that serves documentation and meta tags to instruct "go get" where to find the Upspin source repository. |
Keyserver is a wrapper for a key implementation that presents it as an HTTP interface.
|
Keyserver is a wrapper for a key implementation that presents it as an HTTP interface. |
Package perm implements mutation permission checking for servers.
|
Package perm implements mutation permission checking for servers. |
Package signup provides an http.Handler implementation that serves and validates KeyServer signup requests.
|
Package signup provides an http.Handler implementation that serves and validates KeyServer signup requests. |
Storeserver is a wrapper for a store implementation that presents it as an HTTP interface.
|
Storeserver is a wrapper for a store implementation that presents it as an HTTP interface. |
Package upspinserver is a combined DirServer and StoreServer for use on stand-alone machines.
|
Package upspinserver is a combined DirServer and StoreServer for use on stand-alone machines. |
Package web provides an http.Handler implementation that serves content from the Upspin namespace.
|
Package web provides an http.Handler implementation that serves content from the Upspin namespace. |