The group
module uses the orm
package which provides table storage with support for
primary keys and secondary indexes. orm
also defines Sequence
which is a persistent unique key generator based on a counter that can be used along with Table
s.
Here's the list of tables and associated sequences and indexes stored as part of the group
module.
The groupTable
stores GroupInfo
: 0x0 | []byte(GroupId) -> ProtocolBuffer(GroupInfo)
.
The value of groupSeq
is incremented when creating a new group and corresponds to the new GroupId
: 0x1 | 0x1 -> BigEndian
.
The second 0x1
corresponds to the ORM sequenceStorageKey
.
groupByAdminIndex
allows to retrieve groups by admin address:
0x2 | []byte(group.Admin) | []byte(GroupId) -> []byte()
.
The groupMemberTable
stores GroupMember
s: 0x10 | []byte(GroupId) | []byte(member.Address) -> ProtocolBuffer(GroupMember)
.
The groupMemberTable
is a primary key table and its PrimaryKey
is given by
[]byte(GroupId) | []byte(member.Address)
which is used by the following indexes.
groupMemberByGroupIndex
allows to retrieve group members by group id:
0x11 | []byte(GroupId) | PrimaryKey | byte(len(PrimaryKey)) -> []byte()
.
groupMemberByMemberIndex
allows to retrieve group members by member address:
0x12 | []byte(member.Address) | PrimaryKey | byte(len(PrimaryKey)) -> []byte()
.
A groupDifferentialTable
stores the differences in group membership between states
or heights: `0x30 | []byte(GroupId) | []byte(height) -> ProtocolBuffer(Members)
The groupAccountTable
stores GroupAccountInfo
: 0x20 | []byte(Address) -> ProtocolBuffer(GroupAccountInfo)
.
The groupAccountTable
is a primary key table and its PrimaryKey
is given by
[]byte(Address)
which is used by the following indexes.
The value of groupAccountSeq
is incremented when creating a new group account and is used to generate the new group account Address
:
0x21 | 0x1 -> BigEndian
.
The second 0x1
corresponds to the ORM sequenceStorageKey
.
groupAccountByGroupIndex
allows to retrieve group accounts by group id:
0x22 | []byte(GroupId) | PrimaryKey | byte(len(PrimaryKey)) -> []byte()
.
groupAccountByAdminIndex
allows to retrieve group accounts by admin address:
0x23 | []byte(Address) | PrimaryKey | byte(len(PrimaryKey)) -> []byte()
.