Documentation ¶
Overview ¶
Package lib is a generated protocol buffer package.
It is generated from these files:
test.proto
It has these top-level messages:
Test
Index ¶
- func CurrentWorkload() int
- func GetExternalIP() string
- func GetPort() int
- func GetPrivilege(workload int) int
- func HTTPGet(url string, config *RequestConfig) ([]byte, error)
- func HTTPGetFile(url string, config *RequestConfig) (outFName, contentType string, contentLength int64, err error)
- func HTTPPost(url string, config *RequestConfig) ([]byte, error)
- func MustGetTlsConfiguration(privateKeyFile, certificateFile, caFile string) *tls.Config
- func MustLoadCertificates(privateKeyFile, certificateFile, caFile string) (tls.Certificate, *x509.CertPool)
- func NewHTTPReqeust(method, url string, queries, headers map[string]string, body []byte) (*http.Request, error)
- func RandomString(n int) string
- func Sizeof(objs ...interface{}) (sz uint64)
- type BoltStorage
- func (s *BoltStorage) Close() error
- func (s *BoltStorage) Delete(bucket []byte, k []byte) error
- func (s *BoltStorage) ForEach(bucket []byte, fn func(k, v []byte) error) error
- func (s *BoltStorage) Get(bucket []byte, k []byte) (b []byte, err error)
- func (s *BoltStorage) Set(bucket []byte, k []byte, v []byte) error
- func (s *BoltStorage) WALName() string
- type LimitRate
- type ProtectVar
- type RateLimiter
- type RequestConfig
- type SpinLock
- type Test
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CurrentWorkload ¶
func CurrentWorkload() int
CurrentWorkload returns the current workload of the machine
func GetPrivilege ¶
GetPrivilege returns the privilege of API according to workload
func HTTPGet ¶
func HTTPGet(url string, config *RequestConfig) ([]byte, error)
HTTPGet returns http response body in []byte, timeout in second
func HTTPGetFile ¶
func HTTPGetFile(url string, config *RequestConfig) (outFName, contentType string, contentLength int64, err error)
HTTPGetFile store body in single file, return file and file's content type
func HTTPPost ¶
func HTTPPost(url string, config *RequestConfig) ([]byte, error)
HTTPPost do http post
func MustGetTlsConfiguration ¶
func MustLoadCertificates ¶
func MustLoadCertificates(privateKeyFile, certificateFile, caFile string) (tls.Certificate, *x509.CertPool)
func NewHTTPReqeust ¶
func NewHTTPReqeust(method, url string, queries, headers map[string]string, body []byte) (*http.Request, error)
NewHTTPReqeust makes a http request
func RandomString ¶
RandomString returns the random string with length of n
Types ¶
type BoltStorage ¶
type BoltStorage struct {
// contains filtered or unexported fields
}
func OpenBoltStorage ¶
func OpenBoltStorage(path string, bucket []byte) (*BoltStorage, error)
func (*BoltStorage) Close ¶
func (s *BoltStorage) Close() error
func (*BoltStorage) ForEach ¶
func (s *BoltStorage) ForEach(bucket []byte, fn func(k, v []byte) error) error
func (*BoltStorage) WALName ¶
func (s *BoltStorage) WALName() string
type LimitRate ¶
type LimitRate struct {
// contains filtered or unexported fields
}
LimitRate 有缺陷,见下面 TODO注释.
type ProtectVar ¶
type ProtectVar []byte
func (ProtectVar) Free ¶
func (p ProtectVar) Free() error
func (ProtectVar) Pointer ¶
func (p ProtectVar) Pointer() unsafe.Pointer
func (ProtectVar) ReadWrite ¶
func (p ProtectVar) ReadWrite() error
func (ProtectVar) Readonly ¶
func (p ProtectVar) Readonly() error
type RateLimiter ¶
type RateLimiter struct {
// contains filtered or unexported fields
}
func NewRateLimiter ¶
func NewRateLimiter(limit uint64) *RateLimiter
func (*RateLimiter) Limit ¶
func (r *RateLimiter) Limit() bool
type RequestConfig ¶
type RequestConfig struct { Params map[string]string Headers map[string]string Timeout uint16 Body []byte Client *http.Client }
func NewReqeustConfig ¶
type SpinLock ¶
type SpinLock struct {
// contains filtered or unexported fields
}
SpinLock implements a simple atomic spin lock, the zero value for a SpinLock is an unlocked spinlock.
func (*SpinLock) Lock ¶
func (sl *SpinLock) Lock()
Lock locks sl. If the lock is already in use, the caller blocks until Unlock is called
func (*SpinLock) TryLock ¶
TryLock will try to lock sl and return whether it succeed or not without blocking.
func (*SpinLock) Unlock ¶
func (sl *SpinLock) Unlock()
Unlock unlocks sl, unlike [Mutex.Unlock](http://golang.org/pkg/sync/#Mutex.Unlock), there's no harm calling it on an unlocked SpinLock
type Test ¶
type Test struct { Label string `protobuf:"bytes,1,opt,name=label" json:"label,omitempty"` Type int32 `protobuf:"varint,2,opt,name=type" json:"type,omitempty"` Reps []int64 `protobuf:"varint,3,rep,packed,name=reps" json:"reps,omitempty"` }
func (*Test) Descriptor ¶
func (*Test) ProtoMessage ¶
func (*Test) ProtoMessage()