当前位置: 首页>>代码示例>>Golang>>正文


Golang server.Server类代码示例

本文整理汇总了Golang中github.com/coreos/etcd/server.Server的典型用法代码示例。如果您正苦于以下问题:Golang Server类的具体用法?Golang Server怎么用?Golang Server使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了Server类的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。

示例1: testGetLeader

func testGetLeader(s *server.Server, key string) (string, error) {
	resp, err := tests.Get(fmt.Sprintf("%s/mod/v2/leader/%s", s.URL(), key))
	ret := tests.ReadBody(resp)
	return string(ret), err
}
开发者ID:kula,项目名称:etcd,代码行数:5,代码来源:mod_leader_test.go

示例2: testDeleteLeader

func testDeleteLeader(s *server.Server, key string, name string) (string, error) {
	resp, err := tests.DeleteForm(fmt.Sprintf("%s/mod/v2/leader/%s?name=%s", s.URL(), key, name), nil)
	ret := tests.ReadBody(resp)
	return string(ret), err
}
开发者ID:kula,项目名称:etcd,代码行数:5,代码来源:mod_leader_test.go

示例3: testRenewLock

func testRenewLock(s *server.Server, key string, index string, value string, ttl int) (string, int, error) {
	resp, err := tests.PutForm(fmt.Sprintf("%s/mod/v2/lock/%s?index=%s&value=%s&ttl=%d", s.URL(), key, index, value, ttl), nil)
	ret := tests.ReadBody(resp)
	return string(ret), resp.StatusCode, err
}
开发者ID:kakkartushar1,项目名称:ArangoDB,代码行数:5,代码来源:mod_lock_test.go

示例4: testSetLeader

func testSetLeader(s *server.Server, key string, name string, ttl int) (string, error) {
	resp, err := tests.PutForm(fmt.Sprintf("%s/mod/v2/leader/%s?name=%s&ttl=%d", s.URL(), key, name, ttl), nil)
	ret := tests.ReadBody(resp)
	return string(ret), err
}
开发者ID:kula,项目名称:etcd,代码行数:5,代码来源:mod_leader_test.go

示例5: testGetLockValue

func testGetLockValue(s *server.Server, key string) (string, int, error) {
	resp, err := tests.Get(fmt.Sprintf("%s/mod/v2/lock/%s", s.URL(), key))
	ret := tests.ReadBody(resp)
	return string(ret), resp.StatusCode, err
}
开发者ID:kakkartushar1,项目名称:ArangoDB,代码行数:5,代码来源:mod_lock_test.go

示例6: testReleaseLock

func testReleaseLock(s *server.Server, key string, index string, value string) (string, int, error) {
	resp, err := tests.DeleteForm(fmt.Sprintf("%s/mod/v2/lock/%s?index=%s&value=%s", s.URL(), key, index, value), nil)
	ret := tests.ReadBody(resp)
	return string(ret), resp.StatusCode, err
}
开发者ID:kakkartushar1,项目名称:ArangoDB,代码行数:5,代码来源:mod_lock_test.go

示例7: testGetLockIndex

func testGetLockIndex(s *server.Server, key string) (string, error) {
	resp, err := tests.Get(fmt.Sprintf("%s/mod/v2/lock/%s?field=index", s.URL(), key))
	ret := tests.ReadBody(resp)
	return string(ret), err
}
开发者ID:kula,项目名称:etcd,代码行数:5,代码来源:mod_lock_test.go

示例8: testAcquireLock

func testAcquireLock(s *server.Server, key string, value string, ttl int) (string, error) {
	resp, err := tests.PostForm(fmt.Sprintf("%s/mod/v2/lock/%s?value=%s&ttl=%d", s.URL(), key, value, ttl), nil)
	ret := tests.ReadBody(resp)
	return string(ret), err
}
开发者ID:kula,项目名称:etcd,代码行数:5,代码来源:mod_lock_test.go

示例9: testAcquireLockWithTimeout

func testAcquireLockWithTimeout(s *server.Server, key string, value string, ttl int, timeout int) (string, int, error) {
	resp, err := tests.PostForm(fmt.Sprintf("%s/mod/v2/lock/%s?value=%s&ttl=%d&timeout=%d", s.URL(), key, value, ttl, timeout), nil)
	ret := tests.ReadBody(resp)
	return string(ret), resp.StatusCode, err
}
开发者ID:BREWTAN,项目名称:etcd,代码行数:5,代码来源:mod_lock_test.go

示例10: testRenewLock

func testRenewLock(s *server.Server, key string, index int, ttl int) (string, error) {
	resp, err := tests.PutForm(fmt.Sprintf("%s/mod/v2/lock/%s/%d?ttl=%d", s.URL(), key, index, ttl), nil)
	ret := tests.ReadBody(resp)
	return string(ret), err
}
开发者ID:neildunbar,项目名称:etcd,代码行数:5,代码来源:handler_test.go

示例11: testReleaseLock

func testReleaseLock(s *server.Server, key string, index int) (string, error) {
	resp, err := tests.DeleteForm(fmt.Sprintf("%s/mod/v2/lock/%s/%d", s.URL(), key, index), nil)
	ret := tests.ReadBody(resp)
	return string(ret), err
}
开发者ID:neildunbar,项目名称:etcd,代码行数:5,代码来源:handler_test.go


注:本文中的github.com/coreos/etcd/server.Server类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。