Checkpointer(string id, ICheckpointStore store, CheckpointData checkpointData) { this.Id = Preconditions.CheckNotNull(id); this.store = Preconditions.CheckNotNull(store); this.Offset = checkpointData.Offset; this.LastFailedRevivalTime = checkpointData.LastFailedRevivalTime; this.UnhealthySince = checkpointData.UnhealthySince; this.Proposed = checkpointData.Offset; this.closed = new AtomicBoolean(false); }
public NullCheckpointStore(long offset) { var data = new CheckpointData(offset); this.initialCheckpointData = Task.FromResult(data); this.initialCheckpointDataMap = Task.FromResult(new Dictionary <string, CheckpointData>() { { "NullCheckpoint", data } } as IDictionary <string, CheckpointData>); }
Checkpointer(string id, ICheckpointStore store, CheckpointData checkpointData, string endpointId, uint priority) { this.Id = Preconditions.CheckNotNull(id); this.store = Preconditions.CheckNotNull(store); this.Offset = checkpointData.Offset; this.LastFailedRevivalTime = checkpointData.LastFailedRevivalTime; this.UnhealthySince = checkpointData.UnhealthySince; this.Proposed = checkpointData.Offset; this.closed = new AtomicBoolean(false); this.EndpointId = endpointId; this.Priority = priority.ToString(); }
public static async Task <Checkpointer> CreateAsync(string id, ICheckpointStore store) { Preconditions.CheckNotNull(id); Preconditions.CheckNotNull(store); Events.CreateStart(id); CheckpointData checkpointData = await store.GetCheckpointDataAsync(id, CancellationToken.None); var checkpointer = new Checkpointer(id, store, checkpointData); Events.CreateFinished(checkpointer); return(checkpointer); }
public static async Task <MasterCheckpointer> CreateAsync(string id, ICheckpointStore store) { Preconditions.CheckNotNull(id); Preconditions.CheckNotNull(store); Events.CreateStart(id); CheckpointData checkpointData = await store.GetCheckpointDataAsync(id, CancellationToken.None); long offset = checkpointData.Offset; var masterCheckpointer = new MasterCheckpointer(id, store, offset); Events.CreateFinished(masterCheckpointer); return(masterCheckpointer); }
Checkpointer(string id, ICheckpointStore store, CheckpointData checkpointData) { this.Id = Preconditions.CheckNotNull(id); this.store = Preconditions.CheckNotNull(store); this.Offset = checkpointData.Offset; this.LastFailedRevivalTime = checkpointData.LastFailedRevivalTime; this.UnhealthySince = checkpointData.UnhealthySince; this.Proposed = checkpointData.Offset; this.closed = new AtomicBoolean(false); // The endpoint ID and priority is encoded into the checkpointer ID // using the following format: // {endpointId}_Pri{priority} // We use "_Pri" as a delimiter to parse the endpoint ID and priority // back out for metrics reporting string[] tokens = id.Split(new string[] { "_Pri" }, System.StringSplitOptions.RemoveEmptyEntries); switch (tokens.Length) { case 1: // There's no priority value, which means this is // the checkpointer for the default priority this.EndpointId = tokens[0]; this.Priority = RouteFactory.DefaultPriority.ToString(); break; case 2: this.EndpointId = tokens[0]; this.Priority = tokens[1]; break; default: // Bad format (maybe due to testcase or some other such) this.EndpointId = string.Empty; this.Priority = string.Empty; break; } }
public Task SetCheckpointDataAsync(string id, CheckpointData checkpointData, CancellationToken token) { this.checkpointDataMap[id] = checkpointData; return(TaskEx.Done); }
public Task SetCheckpointDataAsync(string id, CheckpointData checkpointData, CancellationToken token) => TaskEx.Done;