WIP: so much stuff on the coordinator and protocol
parent
f03f412c6f
commit
edd0529160
|
@ -66,3 +66,11 @@ Modules
|
|||
| Storage Engine | | Storage Engine |
|
||||
| | | |
|
||||
+--------+-----------+ +-------+------------+
|
||||
|
||||
Concensus Notes
|
||||
---------------
|
||||
|
||||
Two state machines:
|
||||
* 1 for the entire cluster of which machines are taking which portions of the ring
|
||||
* 1 for each portion of the ring to replicate the operations
|
||||
sequence number per ring location? that's the concensus, if they don't agree then request a replay from the last known sequence number
|
||||
|
|
|
@ -0,0 +1,21 @@
|
|||
package coordinator
|
||||
|
||||
import (
|
||||
. "launchpad.net/gocheck"
|
||||
"testing"
|
||||
)
|
||||
|
||||
// Hook up gocheck into the gotest runner.
|
||||
func Test(t *testing.T) {
|
||||
TestingT(t)
|
||||
}
|
||||
|
||||
type CoordinatorSuite struct{}
|
||||
|
||||
var _ = Suite(&CoordinatorSuite{})
|
||||
|
||||
func (self *CoordinatorSuite) TestCanCreateCoordinatorWithNoSeed(c *C) {
|
||||
}
|
||||
|
||||
func (self *CoordinatorSuite) TestCanCreateCoordinatorWithSeedThatIsNotRunning(c *C) {
|
||||
}
|
|
@ -1,9 +1,45 @@
|
|||
package coordinator
|
||||
|
||||
import (
|
||||
"datastore"
|
||||
"protocol"
|
||||
"query"
|
||||
)
|
||||
|
||||
type Coordinator interface {
|
||||
DistributeQuery(query *protocol.Query, yield func(*protocol.Series) error) error
|
||||
DistributeQuery(query *query.Query, yield func(*protocol.Series) error) error
|
||||
WriteSeriesData(series *protocol.Series) error
|
||||
}
|
||||
|
||||
type ClusterServer interface {
|
||||
Datastore
|
||||
RingLocations() []*RingLocation
|
||||
AddRingLocation(ringLocation *RingLocation) error
|
||||
RemoveRingLocation(ringLocation *RingLocation) error
|
||||
}
|
||||
|
||||
type ClusterConfiguration interface {
|
||||
JoinServer(seedServers []string, server string) error
|
||||
RemoveServer(server string)
|
||||
GetClusterServersForRingLocation(ringLocation int64) []*ClusterServer
|
||||
GetRingLocationsForQuery(query *query.Query) []int64
|
||||
|
||||
getServers() []*ClusterServer
|
||||
splitSeriesIntoLocations(series *protocol.Series) []*SeriesAndRing
|
||||
}
|
||||
|
||||
type ClusterServerImpl struct {
|
||||
host string
|
||||
ringLocations []*RingLocation
|
||||
}
|
||||
|
||||
type RingLocation struct {
|
||||
location int64
|
||||
totalData int64
|
||||
averageVolume int64
|
||||
}
|
||||
|
||||
type SeriesAndRing struct {
|
||||
series *protocol.Series
|
||||
ringLocation int64
|
||||
}
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
package coordinator
|
|
@ -0,0 +1,11 @@
|
|||
package datastore
|
||||
|
||||
import (
|
||||
"protocol"
|
||||
"query"
|
||||
)
|
||||
|
||||
type Datastore interface {
|
||||
ExecuteQuery(ringLocation int64, query *query.Query, yield func(*protocol.Series) error) error
|
||||
WriteSeriesData(ringLocation int64, series *protocol.Series) error
|
||||
}
|
|
@ -28,4 +28,25 @@ message Series {
|
|||
repeated Point points = 1;
|
||||
required string name = 2;
|
||||
repeated FieldDefinition fields = 3;
|
||||
}
|
||||
|
||||
message Request {
|
||||
enum Type {
|
||||
QUERY = 1;
|
||||
WRITE = 2;
|
||||
GET_SERVERS = 3;
|
||||
}
|
||||
required int32 id = 1;
|
||||
required Type type = 2;
|
||||
}
|
||||
|
||||
message Response {
|
||||
enum Type {
|
||||
QUERY = 1;
|
||||
WRITE_OK = 2;
|
||||
END_STREAM = 3;
|
||||
}
|
||||
required int32 id = 1;
|
||||
optional Series series = 2;
|
||||
repeated string servers = 3;
|
||||
}
|
Loading…
Reference in New Issue