-
Notifications
You must be signed in to change notification settings - Fork 3.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
***WIP*** First pass at range allocation. Lays down a basic algorithm…
… for selecting a set of peers to send a new range to. MISSING 1) A lot of the config data structures are straw men right now 2) The actual data in the gossip 3) Most Tests Test Plan: go test ./... Reviewers: spencerkimball Reviewed By: spencerkimball Differential Revision: http://phabricator.andybons.com/D25
- Loading branch information
Levon Lloyd
committed
Apr 17, 2014
1 parent
f0af605
commit 8afb7eb
Showing
5 changed files
with
240 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
// Copyright 2014 The Cockroach Authors. | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or | ||
// implied. See the License for the specific language governing | ||
// permissions and limitations under the License. See the AUTHORS file | ||
// for names of contributors. | ||
// Author: Levon Lloyd ([email protected]) | ||
|
||
package storage | ||
|
||
import ( | ||
"log" | ||
"reflect" | ||
"testing" | ||
) | ||
|
||
var testConfig = ZoneConfig{ | ||
Replicas: map[string][]DiskType{ | ||
"a": []DiskType{1, 2}, | ||
"b": []DiskType{1, 2}, | ||
}, | ||
} | ||
|
||
func TestZoneConfigRoundTrip(t *testing.T) { | ||
yaml, err := testConfig.ToYAML() | ||
if err != nil { | ||
log.Fatalf("failed converting to yaml: %v", err) | ||
} | ||
parsedZoneConfig, err := ParseZoneConfig(yaml) | ||
if err != nil { | ||
log.Fatalf("failed parsing config: %v", err) | ||
} | ||
if !reflect.DeepEqual(testConfig, *parsedZoneConfig) { | ||
log.Fatalf("yaml round trip configs differ.\nOriginal: %+v\nParse: %+v\n", testConfig, parsedZoneConfig) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters