store

package
v0.0.0-...-153d94f Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 5, 2018 License: GPL-3.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type SQLGroupStore

type SQLGroupStore struct {
	// contains filtered or unexported fields
}

SQLGroupStore has just one single writer which is this instance but can be used concurrently. It uses TopicRelationStore to store and retrieve data. Tags are currently not stored separately.

func NewSQLGroupStoreFromRelationStoreMustInit

func NewSQLGroupStoreFromRelationStoreMustInit(
	topicRelationStore *SQLTopicRelationStore,
	fnIsSaneStorableGroup func(g Group) (err error),
	minimumContextID uint64,
) (self *SQLGroupStore)

NewSQLGroupStoreFromRelationStoreMustInit allocates and initializes a new SQLGroupStore. fnIsSaneStorableGroup checks whether the Group g is sane to be inserted on each Insert. If it is nil, the standard minimumContextID is used if different types are stored in the TopicStore and/or RelationStore tables. This is the minimum ID that might be generated for an InsertGroup by this store. The minimumContextID is also used as BaseTopicType for each InsertGroup, if the Group has a BaseTopicType of 0.

func NewSQLGroupStoreMustInit

func NewSQLGroupStoreMustInit(
	driverName string,
	dataSourceName string,
	topicTableName string,
	relationTableName string,
	fnIsSaneStorableGroup func(g Group) (err error),
	minimumContextID uint64,
) (self *SQLGroupStore)

NewSQLGroupStoreMustInit allocates and initializes a new SQLGroupStore. fnIsSaneStorableGroup checks whether the Group g is sane to be inserted on each Insert. minimumContextID is used if different types are stored in the TopicStore and/or RelationStore tables. This is the minimum ID that might be generated for an InsertGroup by this store.

func (*SQLGroupStore) Close

func (self *SQLGroupStore) Close()

Close closes the underlying store and db. TODO: this must be done better.

func (*SQLGroupStore) GetGroupsByIDIN

func (self *SQLGroupStore) GetGroupsByIDIN(
	withMembers bool,
	h UnmarshalHandle,
	ids ...uint64,
) (err error)

GetGroupsByIDIN gets Groups each with its members from the underlying topic store and relation store. A more efficient approach must be implemented by the TopicRelationStore

func (*SQLGroupStore) GetGroupsByNameIN

func (self *SQLGroupStore) GetGroupsByNameIN(
	withMembers bool,
	h UnmarshalHandle,
	names ...string,
) (err error)

GetGroupsByNameIN gets Groups each with its members from the underlying topic store and relation store. A more efficient approach must be implemented by the TopicRelationStore

func (*SQLGroupStore) GetGroupsForMemberID

func (self *SQLGroupStore) GetGroupsForMemberID(
	memberID uint64,
	withMembers bool,
	offset, limit uint64,
	h UnmarshalHandle,
) (err error)

GetGroupsForMemberID returns the group where exact this MembersID participates.

func (*SQLGroupStore) GetGroupsForMemberIDPlain

func (self *SQLGroupStore) GetGroupsForMemberIDPlain(
	MemberID uint64,
	withMembers bool,
	offset, limit uint64,
) (sts []StoredTopicData, err error)

GetGroupsForMemberIDPlain returns the group where exact this MembersID participates.

func (*SQLGroupStore) GetGroupsForMembersIDIN

func (self *SQLGroupStore) GetGroupsForMembersIDIN(
	membersIDs []uint64,
	withMembers bool,
	offset, limit uint64,
	h UnmarshalHandle,
) (err error)

GetGroupsForMembersIDIN returns all conversations where these MembersIDs participate.

func (*SQLGroupStore) GetGroupsForMembersIDINExact

func (self *SQLGroupStore) GetGroupsForMembersIDINExact(
	membersIDs []uint64,
	withMembers bool,
	offset, limit uint64,
	h UnmarshalHandle,
) (err error)

GetGroupsForMembersIDINExact returns all groups where exact these MembersIDs participate, not more, not less. This will be done via the hash. sortedMembersIDs must be soreted in ascending order.

func (*SQLGroupStore) GetGroupsForMembersIDINExactPlain

func (self *SQLGroupStore) GetGroupsForMembersIDINExactPlain(
	sortedMembersIDs []uint64,
	withMembers bool,
	offset, limit uint64,
) (sts []StoredTopicData, err error)

GetGroupsForMembersIDINExactPlain returns all groups where exact these MembersIDs participate, not more, not less. This will be done via the hash. sortedMembersIDs must be soreted in ascending order.

func (*SQLGroupStore) GetGroupsForMembersIDINPlain

func (self *SQLGroupStore) GetGroupsForMembersIDINPlain(
	membersIDs []uint64,
	withMembers bool,
	offset, limit uint64,
) (sts []StoredTopicData, err error)

GetGroupsForMembersIDINPlain returns all conversations where these MembersIDs participate.

func (*SQLGroupStore) GetMembersForGroups

func (self *SQLGroupStore) GetMembersForGroups(
	stsGroups []StoredTopicData,
) (err error)

func (*SQLGroupStore) InsertGroup

func (self *SQLGroupStore) InsertGroup(g Group) (err error)

InsertGroup inserts a new group. Neither the ID nor the name of the group may exist. An ID is generated for the group. The group is stored in TopicStore and all the ConversationMembers are stored again separately in RelationStore. There is an additional relation which relates to a hash of all Member ids. This makes the query GetConversationsForMembersIDsExact very easy and fast. Tags could be stored in RelationStore as well but are not atm. If the Group has a BaseTopicType of 0 the minimumContextID is used.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL