Change GetShardSpacesAndShards to just GetShardSpaces
parent
025251198a
commit
d174bc23b3
|
@ -497,7 +497,6 @@ type ShardSpace struct {
|
|||
RetentionPolicy string
|
||||
// this is required. Should be something like 1h, 4h, 1d, 7d, 30d. Less than the retention policy by about a factor of 10
|
||||
ShardDuration string
|
||||
Shards []Shard `json:"-"`
|
||||
// how many servers should have a copy of shards in this space
|
||||
ReplicationFactor uint32
|
||||
// how many shards should be created for each block of time. Series will be distributed across this split
|
||||
|
@ -540,7 +539,7 @@ func (self *Client) GetShardsV2() ([]*Shard, error) {
|
|||
}
|
||||
|
||||
// Added to InfluxDB in 0.8.0
|
||||
func (self *Client) GetShardSpacesAndShards() ([]ShardSpace, error) {
|
||||
func (self *Client) GetShardSpaces() ([]ShardSpace, error) {
|
||||
url := self.getUrlWithUserAndPass("/cluster/shard_spaces", self.username, self.password)
|
||||
body, err := self.get(url)
|
||||
if err != nil {
|
||||
|
|
|
@ -138,26 +138,24 @@ func internalTest(t *testing.T, compression bool) {
|
|||
t.Error(err)
|
||||
}
|
||||
|
||||
spaces, err := client.GetShardSpacesAndShards()
|
||||
spaces, err := client.GetShardSpaces()
|
||||
if err != nil || len(spaces) == 0 {
|
||||
t.Fail()
|
||||
}
|
||||
if spaces[0].Name != "default" {
|
||||
t.Fail()
|
||||
}
|
||||
if spaces[0].Shards[0].Id != 1 {
|
||||
t.Fail()
|
||||
}
|
||||
space := &ShardSpace{Name: "foo", Database: "foobar", Regex: "/^paul_is_rad/"}
|
||||
err = client.CreateShardSpace(space)
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
spaces, _ = client.GetShardSpacesAndShards()
|
||||
spaces, _ = client.GetShardSpaces()
|
||||
if spaces[1].Name != "foo" {
|
||||
t.Fail()
|
||||
}
|
||||
if len(spaces[1].Shards) != 0 {
|
||||
shards, err := client.GetShardsV2()
|
||||
if err != nil {
|
||||
t.Fail()
|
||||
}
|
||||
|
||||
|
@ -173,16 +171,19 @@ func internalTest(t *testing.T, compression bool) {
|
|||
t.Error(err)
|
||||
}
|
||||
|
||||
spaces, _ = client.GetShardSpacesAndShards()
|
||||
if len(spaces[1].Shards) != 1 {
|
||||
t.Fail()
|
||||
spaces, _ = client.GetShardSpaces()
|
||||
count := 0
|
||||
for _, s := range shards {
|
||||
if s.ShardSpace == "foo" {
|
||||
count++
|
||||
}
|
||||
}
|
||||
|
||||
if err := client.DropShardSpace("foo"); err != nil {
|
||||
t.Fail()
|
||||
}
|
||||
|
||||
spaces, err = client.GetShardSpacesAndShards()
|
||||
spaces, err = client.GetShardSpaces()
|
||||
if err != nil || len(spaces) != 1 || spaces[0].Name != "default" {
|
||||
t.Fail()
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue