本文整理汇总了Golang中github.com/pavel-paulau/gateload/api.SyncGatewayClient.AddCookie方法的典型用法代码示例。如果您正苦于以下问题:Golang SyncGatewayClient.AddCookie方法的具体用法?Golang SyncGatewayClient.AddCookie怎么用?Golang SyncGatewayClient.AddCookie使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类github.com/pavel-paulau/gateload/api.SyncGatewayClient
的用法示例。
在下文中一共展示了SyncGatewayClient.AddCookie方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: main
func main() {
runtime.GOMAXPROCS(runtime.NumCPU())
var config workload.Config
workload.ReadConfig(&config)
s := seriesly.SerieslyClient{}
s.Init(config.SerieslyHostname, "sync_latency"+config.SerieslyDatabase)
c := api.SyncGatewayClient{}
c.Init(config.Hostname, config.Database)
user := api.UserAuth{"collector", "password", []string{"stats"}}
c.AddUser(user.Name, user)
session := api.Session{Name: user.Name, TTL: 2592000}
cookie := c.CreateSession(user.Name, session)
c.AddCookie(&cookie)
activeSamplers = 0
for doc := range workload.DocIterator(0, DocsPerUser, config.DocSize, "stats") {
if activeSamplers < MaxSamplers {
activeSamplers++
go measureLatency(&c, &s, doc)
}
time.Sleep(time.Duration(1000) * time.Millisecond)
}
}
示例2: runUser
func runUser(user workload.User, config workload.Config, cookie http.Cookie, wg *sync.WaitGroup) {
c := api.SyncGatewayClient{}
c.Init(config.Hostname, config.Database)
c.AddCookie(&cookie)
log.Printf("Starting new %s (%s)", user.Type, user.Name)
if user.Type == "pusher" {
go workload.RunPusher(&c, user.Channel, config.DocSize, user.SeqId, config.SleepTimeMs, wg)
} else {
go workload.RunPuller(&c, user.Channel, user.Name, wg)
}
}