forked from petabridge/akka-bootcamp
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Messages.cs
58 lines (45 loc) · 1.39 KB
/
Messages.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
namespace GithubActors
{
/// <summary>
/// Begin processing a new Github repository for analysis
/// </summary>
public class ProcessRepo
{
public ProcessRepo(string repoUri)
{
RepoUri = repoUri;
}
public string RepoUri { get; private set; }
}
public class RepoKey
{
public RepoKey(string owner, string repo)
{
Repo = repo;
Owner = owner;
}
public string Owner { get; private set; }
public string Repo { get; private set; }
}
public class RetryableQuery
{
public RetryableQuery(object query, int allowableTries) : this(query, allowableTries, 0)
{
}
private RetryableQuery(object query, int allowableTries, int currentAttempt)
{
AllowableTries = allowableTries;
Query = query;
CurrentAttempt = currentAttempt;
}
public object Query { get; private set; }
public int AllowableTries { get; private set; }
public int CurrentAttempt { get; private set; }
public bool CanRetry { get { return RemainingTries > 0; } }
public int RemainingTries { get { return AllowableTries - CurrentAttempt; } }
public RetryableQuery NextTry()
{
return new RetryableQuery(Query, AllowableTries, CurrentAttempt+1);
}
}
}