Write basic group properties to NoteDb on group updates

This change adds the basic infrastructure for groups in NoteDb and
concentrates on updating the basic group properties. All basic group
properties are stored in a dedicated file on the group branch in the
All-Users repository. The group branch contains the UUID of the group
to allow fast lookups by UUID (which is essential since the group index
is based on UUIDs).

This change is just a small piece of the full implementation of
groups in NoteDb. To ensure that we never write partial NoteDb commits
for groups due to an unfinished implementation (and to save on
intermediate migrations), a special flag is introduced which
disables writing to NoteDb for groups for the moment. We will flip this
flag for tests later on in this series. When the implementation for
writing groups to NoteDb is fully done, we will remove this flag.

Change-Id: Iffeba26ddf9837d7f810c6656357a704964170b7
This commit is contained in:
Alice Kober-Sotzek
2017-10-23 16:05:44 +02:00
parent b4a4c58120
commit bd37b13815
12 changed files with 551 additions and 55 deletions

View File

@@ -30,16 +30,17 @@ public abstract class InternalGroup implements Serializable {
AccountGroup accountGroup,
ImmutableSet<Account.Id> members,
ImmutableSet<AccountGroup.UUID> subgroups) {
return new AutoValue_InternalGroup(
accountGroup.getId(),
accountGroup.getNameKey(),
accountGroup.getDescription(),
accountGroup.getOwnerGroupUUID(),
accountGroup.isVisibleToAll(),
accountGroup.getGroupUUID(),
accountGroup.getCreatedOn(),
members,
subgroups);
return builder()
.setId(accountGroup.getId())
.setNameKey(accountGroup.getNameKey())
.setDescription(accountGroup.getDescription())
.setOwnerGroupUUID(accountGroup.getOwnerGroupUUID())
.setVisibleToAll(accountGroup.isVisibleToAll())
.setGroupUUID(accountGroup.getGroupUUID())
.setCreatedOn(accountGroup.getCreatedOn())
.setMembers(members)
.setSubgroups(subgroups)
.build();
}
public abstract AccountGroup.Id getId();
@@ -64,4 +65,31 @@ public abstract class InternalGroup implements Serializable {
public abstract ImmutableSet<Account.Id> getMembers();
public abstract ImmutableSet<AccountGroup.UUID> getSubgroups();
public static Builder builder() {
return new AutoValue_InternalGroup.Builder();
}
@AutoValue.Builder
public abstract static class Builder {
public abstract Builder setId(AccountGroup.Id id);
public abstract Builder setNameKey(AccountGroup.NameKey name);
public abstract Builder setDescription(@Nullable String description);
public abstract Builder setOwnerGroupUUID(AccountGroup.UUID ownerGroupUuid);
public abstract Builder setVisibleToAll(boolean visibleToAll);
public abstract Builder setGroupUUID(AccountGroup.UUID groupUuid);
public abstract Builder setCreatedOn(Timestamp createdOn);
public abstract Builder setMembers(ImmutableSet<Account.Id> members);
public abstract Builder setSubgroups(ImmutableSet<AccountGroup.UUID> subgroups);
public abstract InternalGroup build();
}
}