當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。