Ejemplo n.º 1
0
        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);
        }
Ejemplo n.º 2
0
        public async Task <ICheckpointer> CreateAsync(string id)
        {
            Events.CreateChildStart(this, id);

            Checkpointer checkpointer = await Checkpointer.CreateAsync(id, this.store);

            var child = new ChildCheckpointer(this, checkpointer);

            await this.AddChild(child);

            Events.CreateChildFinished(this, id);

            return(child);
        }
Ejemplo n.º 3
0
 public static void SetQueueLength(Checkpointer checkpointer) => QueueLength.Set(checkpointer.Proposed - checkpointer.Offset, new[] { checkpointer.EndpointId, checkpointer.Priority });
Ejemplo n.º 4
0
 static string GetContextString(Checkpointer checkpointer)
 {
     return(Invariant($"CheckpointerId: {checkpointer.Id}, Offset: {checkpointer.Offset}, Proposed: {checkpointer.Proposed}"));
 }
Ejemplo n.º 5
0
 public static void Close(Checkpointer checkpointer)
 {
     Log.LogInformation((int)EventIds.Close, "[CheckpointerClose] {conetxt}", GetContextString(checkpointer));
 }
Ejemplo n.º 6
0
 public static void CommitFinished(Checkpointer checkpointer)
 {
     Log.LogInformation((int)EventIds.CommitFinished, "[CheckpointerCommitFinishedo] {context}", GetContextString(checkpointer));
 }
Ejemplo n.º 7
0
 public static void CommitStarted(Checkpointer checkpointer, int successfulCount, int remainingCount)
 {
     Log.LogInformation((int)EventIds.CommitStarted, "[CheckpointerCommitStarted] SuccessfulCount: {0}, RemainingCount: {1}, {2}", successfulCount, remainingCount, GetContextString(checkpointer));
 }
Ejemplo n.º 8
0
 public static void SetQueueLength(Checkpointer checkpointer) => QueueLength.Set(checkpointer.Proposed - checkpointer.Offset, new[] { checkpointer.Id });
Ejemplo n.º 9
0
 private static double CalculateQueueLength(Checkpointer checkpointer) => CalculateQueueLength(checkpointer.Proposed - checkpointer.Offset);
Ejemplo n.º 10
0
 public static void SetQueueLength(Checkpointer checkpointer) => SetQueueLength(CalculateQueueLength(checkpointer), checkpointer.EndpointId, checkpointer.Priority);