Override(user, Repository.currentRevision);
}
}
Commit checks for update conflicts and marks the user as ???pending.??? This will
allow either of two possible actions to complete: MustResolve and CommitComplete.
MustResolve action
A client??™s request to commit changes can only be propagated to the repository if
there are no conflicts.
partial static class User
{
static Set
> ResolveSets()
{
Set> result = Set>.EmptySet;
foreach (string user in Users())
if (commitPending.Contains(user))
{
Set fileConflicts = FileConflicts(user);
if (!fileConflicts.IsEmpty)
result = result.Add(fileConflicts);
}
return result;
}
static Set FileConflicts(string user)
{
Set result = conflicts[user];
foreach (Pair revision in revisions[user])
{
string file = revision.First;
Op op = revision.Second;
if (version[user] < Repository.FileVersion(file) &&
Repository.FileExists(file) &&
op != Op.Delete)
result = result.Add(file);
}
Systems with Complex State 179
return result;
}
static bool MustResolveEnabled(string user, Set files)
{
return IsUser(user) && CommitPending(user) &&
!files.IsEmpty && Object.Equals(files,
FileConflicts(user));
}
[Action]
static void MustResolve([Domain("Users")] string user,
[Domain("ResolveSets")] Set files)
{
commitPending = commitPending.
Pages:
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248