diff options
author | Paul Okstad <pokstad@gitlab.com> | 2019-02-25 19:03:55 +0300 |
---|---|---|
committer | Paul Okstad <pokstad@gitlab.com> | 2019-03-08 09:00:28 +0300 |
commit | cc11fcf106da33c16a84972aa9d9e6b72ec952c6 (patch) | |
tree | 1a385b4056e7b032a414144741e8d5159280e148 | |
parent | f83eef762996a646eeb2dcfe1cd63e2de3d52b6c (diff) |
update design doc for replication
-rw-r--r-- | doc/design_ha.md | 2 | ||||
-rw-r--r-- | internal/praefect/replman.go | 47 |
2 files changed, 48 insertions, 1 deletions
diff --git a/doc/design_ha.md b/doc/design_ha.md index e446dc85e..7e174612a 100644 --- a/doc/design_ha.md +++ b/doc/design_ha.md @@ -11,7 +11,7 @@ The following terminology may be used within the context of the Gitaly HA projec - Praefect - a transparent front end to all Gitaly shards. This reverse proxy ensures that all gRPC calls are forwarded to the correct shard by consulting the coordinator. The reverse proxy also ensures that write actions are performed transactionally when needed. - etymology: from Latin praefectus for _a person appointed to any of various positions of command, authority, or superintendence, as a chief magistrate in ancient Rome or the chief administrative official of a department of France or Italy._ - [pronounced _pree-fect_](https://www.youtube.com/watch?v=MHszCZjPmTQ) -- Node (TODO: we probably need a similar latin name here) - performs the actual git read/write operations to/from disk. Has no knowledge of shards/prafects/coordinators just as the Gitaly service existed prior to HA. +- Backend Node (a.k.a. Gitaly) - performs the actual git read/write operations to/from disk. Has no knowledge of shards/prafects/coordinators just as the Gitaly service existed prior to HA. Sits behind a Praefect server in relation to a request, thus why we consider it a "backend" node. - RPC categories (#1496): - Accessor - a side effect free (or read-only) RPC; does not modify the git repo (!228) - Mutator - an RPC that modifies the data in the git repo (!228) diff --git a/internal/praefect/replman.go b/internal/praefect/replman.go new file mode 100644 index 000000000..e202c219e --- /dev/null +++ b/internal/praefect/replman.go @@ -0,0 +1,47 @@ +package praefect + +// ReplicationManager tracks the progress of RPCs being applied to multiple +// downstream servers that make up a shard. +type ReplicationManager struct { + mu sync.Mutex + map[string]*Shard // maps a project to a shard +} + +type State struct { + Checksum []byte +} + +type Shard struct { + primary string // the storage location for the replica + + // Replicas maps a storage location to a state + replicas map[string]State +} + +func (s *Shard) isConsistent() bool { + for _, r := range s.Replicas { + + } +} + +type MutationTracker struct { + +} + + +func (mt *MutationTracker) Abort() { + +} + +func (mt *MutationTracker) Done() { + +} + +func (rm *ReplicationManager) StartMutation(ctx context.Context, project, storage string) { + +} + + + +func (rm *ReplMan) Access(ctx context.Context) + |