repos

package
v0.0.0-...-9835270 Latest Latest
Warning

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

Go to latest
Published: Sep 22, 2021 License: AGPL-3.0, Apache-2.0, MIT Imports: 29 Imported by: 0

Documentation

Index

Constants

View Source
const (
	OFFLINE_STATE = iota
	FORE_GROUND_STATE
	BACK_GROUND_STATE
)

ios not call report state, last_state 、cur_state = OFFLINE_STATE so ios will not notify, only android call report state and notify

View Source
const (
	USER_OFFLINE_STATE = iota
	USER_ONLINE_STATE
)

user state differ foreground, background online

Variables

This section is empty.

Functions

This section is empty.

Types

type ClientDataStreamRepo

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

func NewClientDataStreamRepo

func NewClientDataStreamRepo(
	bukSize,
	maxEntries,
	gcPerNum int,
) *ClientDataStreamRepo

func (*ClientDataStreamRepo) AddClientDataStream

func (tl *ClientDataStreamRepo) AddClientDataStream(ctx context.Context, dataStream *types.ActDataStreamUpdate, offset int64)

func (*ClientDataStreamRepo) CheckLoadReady

func (tl *ClientDataStreamRepo) CheckLoadReady(ctx context.Context, userID string, sync bool) bool

func (*ClientDataStreamRepo) ExistsAccountDataUpdate

func (tl *ClientDataStreamRepo) ExistsAccountDataUpdate(ctx context.Context, position int64, userID string) bool

func (*ClientDataStreamRepo) GetHistory

func (tl *ClientDataStreamRepo) GetHistory(ctx context.Context, user string) *feedstypes.TimeLines

func (*ClientDataStreamRepo) LoadHistory

func (tl *ClientDataStreamRepo) LoadHistory(ctx context.Context, userID string, sync bool)

func (*ClientDataStreamRepo) SetMonitor

func (tl *ClientDataStreamRepo) SetMonitor(queryHitCounter mon.LabeledCounter)

func (*ClientDataStreamRepo) SetPersist

func (tl *ClientDataStreamRepo) SetPersist(db model.SyncAPIDatabase)

type DefaultHander

type DefaultHander struct {
}

func (*DefaultHander) OnStateChange

func (d *DefaultHander) OnStateChange(*types.NotifyDeviceState)

func (*DefaultHander) OnUserStateChange

func (d *DefaultHander) OnUserStateChange(*types.NotifyUserState)

type Device

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

type DeviceInfo

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

type DisplayNameRepo

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

func NewDisplayNameRepo

func NewDisplayNameRepo() *DisplayNameRepo

func (*DisplayNameRepo) AddPresenceDataStream

func (tl *DisplayNameRepo) AddPresenceDataStream(dataStream *types.PresenceStream)

func (*DisplayNameRepo) GetAvatarUrl

func (tl *DisplayNameRepo) GetAvatarUrl(userID string) string

func (*DisplayNameRepo) GetDisplayName

func (tl *DisplayNameRepo) GetDisplayName(userID string) string

func (*DisplayNameRepo) GetEmail

func (tl *DisplayNameRepo) GetEmail(userID string) string

func (*DisplayNameRepo) GetJobNumber

func (tl *DisplayNameRepo) GetJobNumber(userID string) string

func (*DisplayNameRepo) GetLandline

func (tl *DisplayNameRepo) GetLandline(userID string) string

func (*DisplayNameRepo) GetMobile

func (tl *DisplayNameRepo) GetMobile(userID string) string

func (*DisplayNameRepo) GetOriginDisplayName

func (tl *DisplayNameRepo) GetOriginDisplayName(userID string) string

func (*DisplayNameRepo) GetState

func (tl *DisplayNameRepo) GetState(userID string) int

func (*DisplayNameRepo) GetUserName

func (tl *DisplayNameRepo) GetUserName(userID string) string

func (*DisplayNameRepo) LoadHistory

func (tl *DisplayNameRepo) LoadHistory()

func (*DisplayNameRepo) SetPersist

func (tl *DisplayNameRepo) SetPersist(db model.SyncAPIDatabase)

type DomainTLItem

type DomainTLItem struct {
	MemberCnt int `json:"member_cnt"`
	// contains filtered or unexported fields
}

type EventReadStreamRepo

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

func NewEventReadStreamRepo

func NewEventReadStreamRepo() *EventReadStreamRepo

func (*EventReadStreamRepo) AddUserReceiptOffset

func (tl *EventReadStreamRepo) AddUserReceiptOffset(userID, roomID string, receiptOffset int64)

func (*EventReadStreamRepo) GetUserLastOffset

func (tl *EventReadStreamRepo) GetUserLastOffset(ctx context.Context, userID, roomID string) int64

func (*EventReadStreamRepo) SetMonitor

func (tl *EventReadStreamRepo) SetMonitor(queryHitCounter mon.LabeledCounter)

func (*EventReadStreamRepo) SetPersist

func (tl *EventReadStreamRepo) SetPersist(db model.SyncAPIDatabase)

type Key

type Key interface{}

type KeyChangeStreamRepo

type KeyChangeStreamRepo struct {
	OneTimeKeyCountInfo *sync.Map
	// contains filtered or unexported fields
}

func NewKeyChangeStreamRepo

func NewKeyChangeStreamRepo(
	userTimeLine *UserTimeLineRepo,
) *KeyChangeStreamRepo

func (*KeyChangeStreamRepo) AddKeyChangeStream

func (tl *KeyChangeStreamRepo) AddKeyChangeStream(ctx context.Context,
	dataStream *types.KeyChangeStream, offset int64, broadCast bool)

func (*KeyChangeStreamRepo) CheckLoadReady

func (tl *KeyChangeStreamRepo) CheckLoadReady(ctx context.Context, userID string, sync bool) bool

func (*KeyChangeStreamRepo) ExistsKeyChange

func (tl *KeyChangeStreamRepo) ExistsKeyChange(position int64, userID string) bool

func (*KeyChangeStreamRepo) GetHistory

func (tl *KeyChangeStreamRepo) GetHistory() *sync.Map

func (*KeyChangeStreamRepo) GetOneTimeKeyCount

func (tl *KeyChangeStreamRepo) GetOneTimeKeyCount(userID string, deviceID string) (alCountMap map[string]int, err error)

func (*KeyChangeStreamRepo) GetUserLatestOffset

func (tl *KeyChangeStreamRepo) GetUserLatestOffset(userID string) int64

func (*KeyChangeStreamRepo) LoadHistory

func (tl *KeyChangeStreamRepo) LoadHistory(ctx context.Context, userID string, sync bool)

func (*KeyChangeStreamRepo) SetCache

func (tl *KeyChangeStreamRepo) SetCache(cache service.Cache)

func (*KeyChangeStreamRepo) SetMonitor

func (tl *KeyChangeStreamRepo) SetMonitor(queryHitCounter mon.LabeledCounter)

func (*KeyChangeStreamRepo) SetSyncDB

func (tl *KeyChangeStreamRepo) SetSyncDB(db model.SyncAPIDatabase)

func (*KeyChangeStreamRepo) UpdateOneTimeKeyCount

func (tl *KeyChangeStreamRepo) UpdateOneTimeKeyCount(userID string, deviceID string) error

type Lru

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

func NewLru

func NewLru(maxEntries, gcPerNum int) *Lru

func (*Lru) Add

func (lru *Lru) Add(key Key) Key

func (*Lru) Get

func (lru *Lru) Get(key Key)

type OnlineUserRepo

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

只维护在线

func NewOnlineUserRepo

func NewOnlineUserRepo(ttl, ttlIOS int64) *OnlineUserRepo

func (*OnlineUserRepo) GetLastPos

func (ol *OnlineUserRepo) GetLastPos(uid, devId string) int64

func (*OnlineUserRepo) Notify

func (ol *OnlineUserRepo) Notify(userID, devID string, lastState, curState int)

func (*OnlineUserRepo) Pet

func (ol *OnlineUserRepo) Pet(uid, devId string, pos, ttl int64)

func (*OnlineUserRepo) Release

func (ol *OnlineUserRepo) Release(uid, devId string)

func (*OnlineUserRepo) SetHandler

func (ol *OnlineUserRepo) SetHandler(handler StateChangeHandler)

func (*OnlineUserRepo) UpdateState

func (ol *OnlineUserRepo) UpdateState(uid, devId string, state int)

func (*OnlineUserRepo) UpdateUserState

func (ol *OnlineUserRepo) UpdateUserState(uid string, lastState, curState int)

type PresenceDataStreamRepo

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

func NewPresenceDataStreamRepo

func NewPresenceDataStreamRepo(
	userTimeLine *UserTimeLineRepo,
) *PresenceDataStreamRepo

func (*PresenceDataStreamRepo) AddPresenceDataStream

func (tl *PresenceDataStreamRepo) AddPresenceDataStream(ctx context.Context,
	dataStream *types.PresenceStream, offset int64, broadCast bool)

func (*PresenceDataStreamRepo) CheckLoadReady

func (tl *PresenceDataStreamRepo) CheckLoadReady(ctx context.Context, userID string, sync bool) bool

func (*PresenceDataStreamRepo) ExistsPresence

func (tl *PresenceDataStreamRepo) ExistsPresence(userID string, position int64) bool

func (*PresenceDataStreamRepo) GetHistoryByUserID

func (tl *PresenceDataStreamRepo) GetHistoryByUserID(userID string) *feedstypes.PresenceDataStream

func (*PresenceDataStreamRepo) LoadHistory

func (tl *PresenceDataStreamRepo) LoadHistory(ctx context.Context, userID string, sync bool)

func (*PresenceDataStreamRepo) SetCfg

func (tl *PresenceDataStreamRepo) SetCfg(cfg *config.Dendrite)

func (*PresenceDataStreamRepo) SetMonitor

func (tl *PresenceDataStreamRepo) SetMonitor(queryHitCounter mon.LabeledCounter)

func (*PresenceDataStreamRepo) SetPersist

func (tl *PresenceDataStreamRepo) SetPersist(db model.SyncAPIDatabase)

type RangeItem

type RangeItem struct {
	Start int64 `json:"start"`
	End   int64 `json:"end"`
	// contains filtered or unexported fields
}

type ReadCountRepo

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

func NewReadCountRepo

func NewReadCountRepo(
	delay int,
) *ReadCountRepo

func (*ReadCountRepo) GetRoomReadCount

func (tl *ReadCountRepo) GetRoomReadCount(roomID, userID string) (int64, int64)

func (*ReadCountRepo) SetCache

func (tl *ReadCountRepo) SetCache(cache service.Cache)

func (*ReadCountRepo) UpdateRoomReadCount

func (tl *ReadCountRepo) UpdateRoomReadCount(roomID, eventID, userID, updateType string)

func (*ReadCountRepo) UpdateRoomReadCountFromCache

func (tl *ReadCountRepo) UpdateRoomReadCountFromCache(roomID, userID string)

type ReceiptDataStreamRepo

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

func NewReceiptDataStreamRepo

func NewReceiptDataStreamRepo(
	delay int,
	tlSize int,
	flushDB bool,
) *ReceiptDataStreamRepo

func (*ReceiptDataStreamRepo) AddReceiptDataStream

func (tl *ReceiptDataStreamRepo) AddReceiptDataStream(ctx context.Context, dataStream *types.ReceiptStream, offset int64)

func (*ReceiptDataStreamRepo) CheckLoadReady

func (tl *ReceiptDataStreamRepo) CheckLoadReady(ctx context.Context, roomID string, sync bool) bool

func (*ReceiptDataStreamRepo) ExistsReceipt

func (tl *ReceiptDataStreamRepo) ExistsReceipt(position int64, userID string) bool

func (*ReceiptDataStreamRepo) GetHistory

func (tl *ReceiptDataStreamRepo) GetHistory(ctx context.Context, roomID string) *feedstypes.TimeLines

func (*ReceiptDataStreamRepo) GetRoomLastOffset

func (tl *ReceiptDataStreamRepo) GetRoomLastOffset(roomID string) int64

func (*ReceiptDataStreamRepo) GetUserLatestOffset

func (tl *ReceiptDataStreamRepo) GetUserLatestOffset(userID string) int64

func (*ReceiptDataStreamRepo) LoadHistory

func (tl *ReceiptDataStreamRepo) LoadHistory(ctx context.Context, roomID string, sync bool)

func (*ReceiptDataStreamRepo) LoadRoomLatest

func (tl *ReceiptDataStreamRepo) LoadRoomLatest(ctx context.Context, rooms []string)

func (*ReceiptDataStreamRepo) SetMonitor

func (tl *ReceiptDataStreamRepo) SetMonitor(queryHitCounter mon.LabeledCounter)

func (*ReceiptDataStreamRepo) SetPersist

func (tl *ReceiptDataStreamRepo) SetPersist(db model.SyncAPIDatabase)

func (*ReceiptDataStreamRepo) SetRsCurState

func (tl *ReceiptDataStreamRepo) SetRsCurState(rsCurState *RoomCurStateRepo)

func (*ReceiptDataStreamRepo) SetRsTimeline

func (tl *ReceiptDataStreamRepo) SetRsTimeline(rsTimeline *RoomStateTimeLineRepo)

type ReceiptStreamContent

type ReceiptStreamContent struct {
	CurrentOffset int64
	Content       *feedstypes.TimeLines
}

type RoomCurStateRepo

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

func (*RoomCurStateRepo) GetRoomState

func (repo *RoomCurStateRepo) GetRoomState(roomID string) *RoomState

func (*RoomCurStateRepo) SetPersist

func (tl *RoomCurStateRepo) SetPersist(db model.SyncAPIDatabase)

type RoomHistoryTimeLineRepo

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

func NewRoomHistoryTimeLineRepo

func NewRoomHistoryTimeLineRepo(
	bukSize,
	maxEntries,
	gcPerNum int,
) *RoomHistoryTimeLineRepo

func (*RoomHistoryTimeLineRepo) AddEv

func (*RoomHistoryTimeLineRepo) CheckLoadReady

func (tl *RoomHistoryTimeLineRepo) CheckLoadReady(ctx context.Context, roomID string, sync bool) bool

func (*RoomHistoryTimeLineRepo) GetDomainMaxStream

func (tl *RoomHistoryTimeLineRepo) GetDomainMaxStream(ctx context.Context, roomID, domain string) int64

func (*RoomHistoryTimeLineRepo) GetHistory

func (tl *RoomHistoryTimeLineRepo) GetHistory(ctx context.Context, roomID string) *feedstypes.TimeLines

func (*RoomHistoryTimeLineRepo) GetLastEvent

func (tl *RoomHistoryTimeLineRepo) GetLastEvent(ctx context.Context, roomID string) *feedstypes.StreamEvent

func (*RoomHistoryTimeLineRepo) GetLastMessageEvent

func (tl *RoomHistoryTimeLineRepo) GetLastMessageEvent(ctx context.Context, roomID string) (*feedstypes.StreamEvent, *feedstypes.StreamEvent)

func (*RoomHistoryTimeLineRepo) GetRoomLastOffset

func (tl *RoomHistoryTimeLineRepo) GetRoomLastOffset(roomID string) int64

func (*RoomHistoryTimeLineRepo) GetRoomMinStream

func (tl *RoomHistoryTimeLineRepo) GetRoomMinStream(ctx context.Context, roomID string) int64

func (*RoomHistoryTimeLineRepo) GetStreamEv

func (tl *RoomHistoryTimeLineRepo) GetStreamEv(ctx context.Context, roomID, eventId string) *feedstypes.StreamEvent

func (*RoomHistoryTimeLineRepo) LoadHistory

func (tl *RoomHistoryTimeLineRepo) LoadHistory(ctx context.Context, roomID string, sync bool)

func (*RoomHistoryTimeLineRepo) LoadRoomLatest

func (tl *RoomHistoryTimeLineRepo) LoadRoomLatest(ctx context.Context, rooms []syncapitypes.SyncRoom) error

func (*RoomHistoryTimeLineRepo) SetCache

func (tl *RoomHistoryTimeLineRepo) SetCache(cache service.Cache)

func (*RoomHistoryTimeLineRepo) SetDomainMaxStream

func (tl *RoomHistoryTimeLineRepo) SetDomainMaxStream(roomID, domain string, offset int64)

func (*RoomHistoryTimeLineRepo) SetMonitor

func (tl *RoomHistoryTimeLineRepo) SetMonitor(queryHitCounter mon.LabeledCounter)

func (*RoomHistoryTimeLineRepo) SetPersist

func (tl *RoomHistoryTimeLineRepo) SetPersist(db model.SyncAPIDatabase)

func (*RoomHistoryTimeLineRepo) SetRoomMinStream

func (tl *RoomHistoryTimeLineRepo) SetRoomMinStream(roomID string, minStream int64)

type RoomServerCurStateRepo

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

func NewRoomServerCurStateRepo

func NewRoomServerCurStateRepo(
	persist model.RoomServerDatabase,
	cache service.Cache,
	queryHitCounter mon.LabeledCounter,
) *RoomServerCurStateRepo

func (*RoomServerCurStateRepo) FlushRoomState

func (repo *RoomServerCurStateRepo) FlushRoomState(rs *RoomServerState)

func (*RoomServerCurStateRepo) GetCache

func (repo *RoomServerCurStateRepo) GetCache() service.Cache

func (*RoomServerCurStateRepo) GetRoomState

func (repo *RoomServerCurStateRepo) GetRoomState(ctx context.Context, roomid string) *RoomServerState

func (*RoomServerCurStateRepo) GetRoomStateExt

func (repo *RoomServerCurStateRepo) GetRoomStateExt(ctx context.Context, roomid string) (stateExt *types.RoomStateExt, err error)

func (*RoomServerCurStateRepo) OnEvent

func (*RoomServerCurStateRepo) OnEventRecover

func (repo *RoomServerCurStateRepo) OnEventRecover(ctx context.Context, ev *gomatrixserverlib.Event, offset int64) *RoomServerState

func (*RoomServerCurStateRepo) UpdateRoomStateExt

func (repo *RoomServerCurStateRepo) UpdateRoomStateExt(roomid string, ext map[string]interface{}) (err error)

type RoomServerState

type RoomServerState struct {
	RoomNid     int64
	SnapId      int64
	IsEncrypted bool `json:"is_encrypt"`
	IsFed       bool `json:"is_fed"`

	Creator           *gomatrixserverlib.Event `json:"create_ev"`
	JoinRule          *gomatrixserverlib.Event `json:"join_rule_ev"`
	HistoryVisibility *gomatrixserverlib.Event `json:"history_visibility_ev"`
	Visibility        *gomatrixserverlib.Event `json:"visibility_ev"`
	Name              *gomatrixserverlib.Event `json:"name_ev"`
	Topic             *gomatrixserverlib.Event `json:"topic_ev"`
	Desc              *gomatrixserverlib.Event `json:"desc_ev"`
	CanonicalAlias    *gomatrixserverlib.Event `json:"canonical_alias_ev"`
	Alias             *gomatrixserverlib.Event `json:"alias_ev"`
	Power             *gomatrixserverlib.Event `json:"power_ev"`
	GuestAccess       *gomatrixserverlib.Event `json:"guest_access"`

	Avatar *gomatrixserverlib.Event `json:"avatar_ev"`
	Pin    *gomatrixserverlib.Event `json:"pin_ev"`

	JoinExport        map[string]*gomatrixserverlib.Event `json:"join_map"`
	LeaveExport       map[string]*gomatrixserverlib.Event `json:"leave_map"`
	InviteExport      map[string]*gomatrixserverlib.Event `json:"invite_map"`
	ThirdInviteExport map[string]*gomatrixserverlib.Event `json:"third_invite_map"`
	DomainsExport     map[string]*DomainTLItem            `json:"domains"`

	Version int32 `json:"version"`
	// contains filtered or unexported fields
}

func (*RoomServerState) Create

func (rs *RoomServerState) Create() (*gomatrixserverlib.Event, error)

func (*RoomServerState) GetAllState

func (rs *RoomServerState) GetAllState() []gomatrixserverlib.Event

remain

func (*RoomServerState) GetDepth

func (rs *RoomServerState) GetDepth() int64

func (*RoomServerState) GetDomainTlMap

func (rs *RoomServerState) GetDomainTlMap() *sync.Map

func (*RoomServerState) GetInviteMap

func (rs *RoomServerState) GetInviteMap() *sync.Map

func (*RoomServerState) GetJoinMap

func (rs *RoomServerState) GetJoinMap() *sync.Map

func (*RoomServerState) GetLastDomainOffset

func (rs *RoomServerState) GetLastDomainOffset(ev *gomatrixserverlib.Event, domain string) int64

func (*RoomServerState) GetLastMsgID

func (rs *RoomServerState) GetLastMsgID() string

func (*RoomServerState) GetLastState

func (rs *RoomServerState) GetLastState() []int64

func (*RoomServerState) GetLeaveMap

func (rs *RoomServerState) GetLeaveMap() *sync.Map

func (*RoomServerState) GetOutEventOffset

func (rs *RoomServerState) GetOutEventOffset() int64

func (*RoomServerState) GetPreEvent

获取preEv 以及是否state-ev

func (*RoomServerState) GetRefs

func (rs *RoomServerState) GetRefs(ev *gomatrixserverlib.Event) (string, []byte)

func (*RoomServerState) GetRoomID

func (rs *RoomServerState) GetRoomID() string

func (*RoomServerState) GetRoomNID

func (rs *RoomServerState) GetRoomNID() int64

func (*RoomServerState) GetSnapId

func (rs *RoomServerState) GetSnapId() int64

func (*RoomServerState) GetThirdInviteMap

func (rs *RoomServerState) GetThirdInviteMap() *sync.Map

func (*RoomServerState) HasUpdate

func (rs *RoomServerState) HasUpdate() bool

func (*RoomServerState) IsDirect

func (rs *RoomServerState) IsDirect() bool

func (*RoomServerState) JoinRules

func (rs *RoomServerState) JoinRules() (*gomatrixserverlib.Event, error)

func (*RoomServerState) Member

func (rs *RoomServerState) Member(stateKey string) (*gomatrixserverlib.Event, error)

func (*RoomServerState) PowerLevels

func (rs *RoomServerState) PowerLevels() (*gomatrixserverlib.Event, error)

func (*RoomServerState) SetRoomNID

func (rs *RoomServerState) SetRoomNID(nid int64)

func (*RoomServerState) SetSnapId

func (rs *RoomServerState) SetSnapId(snap int64)

func (*RoomServerState) ThirdPartyInvite

func (rs *RoomServerState) ThirdPartyInvite(stateKey string) (*gomatrixserverlib.Event, error)

func (*RoomServerState) UpdateDepth

func (rs *RoomServerState) UpdateDepth(depth int64)

func (*RoomServerState) UpdateDomainExt

func (rs *RoomServerState) UpdateDomainExt(domains map[string]int64)

func (*RoomServerState) UpdateMsgExt

func (rs *RoomServerState) UpdateMsgExt(preStateId, lastStateId, preMsgId, lastMsgId string)

func (*RoomServerState) UpdateOutEventOffset

func (rs *RoomServerState) UpdateOutEventOffset(outEventOffset int64)

type RoomServerUserMembershipRepo

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

func NewRoomServerUserMembershipRepo

func NewRoomServerUserMembershipRepo(persist model.RoomServerDatabase, cache service.Cache, queryHitCounter mon.LabeledCounter) *RoomServerUserMembershipRepo

func (*RoomServerUserMembershipRepo) GetInviteMemberShip

func (repo *RoomServerUserMembershipRepo) GetInviteMemberShip(ctx context.Context, userID string) (map[string]int64, error)

func (*RoomServerUserMembershipRepo) GetJoinMemberShip

func (repo *RoomServerUserMembershipRepo) GetJoinMemberShip(ctx context.Context, userID string) (ms []string, err error)

func (*RoomServerUserMembershipRepo) GetLeaveMemberShip

func (repo *RoomServerUserMembershipRepo) GetLeaveMemberShip(ctx context.Context, userID string) (map[string]int64, error)

func (*RoomServerUserMembershipRepo) OnEvent

type RoomState

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

func (*RoomState) ArrangeVisibilityRange

func (rs *RoomState) ArrangeVisibilityRange(user string)

func (*RoomState) CheckEventVisibility

func (rs *RoomState) CheckEventVisibility(user string, pos int64) bool

func (*RoomState) GetCreator

func (rs *RoomState) GetCreator() string

func (*RoomState) GetEventVisibility

func (rs *RoomState) GetEventVisibility(user string) []RangeItem

func (*RoomState) GetFederate

func (rs *RoomState) GetFederate() bool

func (*RoomState) GetJoinMap

func (rs *RoomState) GetJoinMap() *sync.Map

func (*RoomState) GetJoinRule

func (rs *RoomState) GetJoinRule() string

func (*RoomState) GetLeaveMap

func (rs *RoomState) GetLeaveMap() *sync.Map

func (*RoomState) GetPowerLevels

func (rs *RoomState) GetPowerLevels() *common.PowerLevelContent

func (*RoomState) GetPreState

func (*RoomState) GetState

func (rs *RoomState) GetState(typ string, key string) *feedstypes.StreamEvent

func (*RoomState) IsChannel

func (rs *RoomState) IsChannel() bool

func (*RoomState) IsDirect

func (rs *RoomState) IsDirect() bool

func (*RoomState) IsEncrypted

func (rs *RoomState) IsEncrypted() bool

func (*RoomState) IsSecret

func (rs *RoomState) IsSecret() bool

type RoomStateTimeLineRepo

type RoomStateTimeLineRepo struct {
	QueryHitCounter mon.LabeledCounter
	// contains filtered or unexported fields
}

存储state timeline, 没有房间timeline 负责加载数据

func NewRoomStateTimeLineRepo

func NewRoomStateTimeLineRepo(
	bukSize int,
	rsRepo *RoomCurStateRepo,
	maxEntries,
	gcPerNum int,
) *RoomStateTimeLineRepo

room state time line 不限制大小

func (*RoomStateTimeLineRepo) AddBackfillEv

func (tl *RoomStateTimeLineRepo) AddBackfillEv(ctx context.Context, ev *gomatrixserverlib.ClientEvent, offset int64, load bool)

func (*RoomStateTimeLineRepo) AddEv

func (tl *RoomStateTimeLineRepo) AddEv(ctx context.Context, ev *gomatrixserverlib.ClientEvent, offset int64, load bool)

kafka 消费数据,load设置为true

func (*RoomStateTimeLineRepo) AddStreamEv

func (tl *RoomStateTimeLineRepo) AddStreamEv(ctx context.Context,
	ev *gomatrixserverlib.ClientEvent, offset int64, load bool)

func (*RoomStateTimeLineRepo) CheckStateLoadReady

func (tl *RoomStateTimeLineRepo) CheckStateLoadReady(ctx context.Context, roomID string, sync bool) bool

func (*RoomStateTimeLineRepo) CheckStreamLoadReady

func (tl *RoomStateTimeLineRepo) CheckStreamLoadReady(ctx context.Context, roomID string, sync bool) bool

func (*RoomStateTimeLineRepo) DelEv

func (tl *RoomStateTimeLineRepo) DelEv(ctx context.Context, roomID string, removedEventIDs []string)

func (*RoomStateTimeLineRepo) GetStateEvents

func (tl *RoomStateTimeLineRepo) GetStateEvents(ctx context.Context, roomID string, endPos int64) ([]*feedstypes.StreamEvent, []*gomatrixserverlib.ClientEvent)

func (*RoomStateTimeLineRepo) GetStateStreams

func (tl *RoomStateTimeLineRepo) GetStateStreams(ctx context.Context, roomID string) *feedstypes.TimeLines

func (*RoomStateTimeLineRepo) GetStates

func (tl *RoomStateTimeLineRepo) GetStates(ctx context.Context, roomID string) *feedstypes.TimeLines

func (*RoomStateTimeLineRepo) LoadStates

func (tl *RoomStateTimeLineRepo) LoadStates(ctx context.Context, roomID string, sync bool)

func (*RoomStateTimeLineRepo) LoadStreamStates

func (tl *RoomStateTimeLineRepo) LoadStreamStates(ctx context.Context, roomID string, sync bool)

func (*RoomStateTimeLineRepo) RemoveStateStreams

func (tl *RoomStateTimeLineRepo) RemoveStateStreams(roomID string)

func (*RoomStateTimeLineRepo) SetMonitor

func (tl *RoomStateTimeLineRepo) SetMonitor(queryHitCounter mon.LabeledCounter)

func (*RoomStateTimeLineRepo) SetPersist

func (tl *RoomStateTimeLineRepo) SetPersist(db model.SyncAPIDatabase)

type STDEventStreamRepo

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

func NewSTDEventStreamRepo

func NewSTDEventStreamRepo(
	cfg *config.Dendrite,
	bukSize,
	maxEntries,
	gcPerNum,
	delay int,
) *STDEventStreamRepo

func (*STDEventStreamRepo) AddSTDEventStream

func (tl *STDEventStreamRepo) AddSTDEventStream(ctx context.Context, dataStream *types.StdEvent, targetUserID, targetDeviceID string)

func (*STDEventStreamRepo) CheckLoadReady

func (tl *STDEventStreamRepo) CheckLoadReady(ctx context.Context, targetUserID, targetDeviceID string, sync bool) bool

func (*STDEventStreamRepo) ExistsSTDEventUpdate

func (tl *STDEventStreamRepo) ExistsSTDEventUpdate(ctx context.Context, position int64, targetUserID, targetDeviceID string) bool

func (*STDEventStreamRepo) GetHistory

func (tl *STDEventStreamRepo) GetHistory(ctx context.Context, targetUserID, targetDeviceID string) *feedstypes.TimeLines

func (*STDEventStreamRepo) LoadHistory

func (tl *STDEventStreamRepo) LoadHistory(ctx context.Context, targetUserID, targetDeviceID string, sync bool)

func (*STDEventStreamRepo) SetMonitor

func (tl *STDEventStreamRepo) SetMonitor(queryHitCounter mon.LabeledCounter)

func (*STDEventStreamRepo) SetPersist

func (tl *STDEventStreamRepo) SetPersist(db model.SyncAPIDatabase)

type SortedEventArray

type SortedEventArray []gomatrixserverlib.Event

func (SortedEventArray) Len

func (list SortedEventArray) Len() int

func (SortedEventArray) Less

func (list SortedEventArray) Less(i, j int) bool

func (SortedEventArray) Swap

func (list SortedEventArray) Swap(i, j int)

type StateChangeHandler

type StateChangeHandler interface {
	OnStateChange(*types.NotifyDeviceState)
	OnUserStateChange(*types.NotifyUserState)
}

type TimeLineRepo

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

func NewTimeLineRepo

func NewTimeLineRepo(
	bukSize int,
	tlSize int,
	tlLimit bool,
	maxEntries,
	gcPerNum int,
) *TimeLineRepo

type UpdatedCountKey

type UpdatedCountKey struct {
	RoomID string
	UserID string
}

type User

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

type UserDev

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

type UserDeviceActiveRepo

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

func NewUserDeviceActiveRepo

func NewUserDeviceActiveRepo(
	delay int64,
	flushDB bool,
) *UserDeviceActiveRepo

func (*UserDeviceActiveRepo) SetPersist

func (uda *UserDeviceActiveRepo) SetPersist(db model.DeviceDatabase)

func (*UserDeviceActiveRepo) UpdateDevActiveTs

func (uda *UserDeviceActiveRepo) UpdateDevActiveTs(uid, devId string)

type UserReceiptRepo

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

func NewUserReceiptRepo

func NewUserReceiptRepo(
	delay int,
) *UserReceiptRepo

func (*UserReceiptRepo) AddUserReceipt

func (tl *UserReceiptRepo) AddUserReceipt(receipt *types.UserReceipt)

func (*UserReceiptRepo) CheckLoadReady

func (tl *UserReceiptRepo) CheckLoadReady(ctx context.Context, userID, roomID string, sync bool) bool

func (*UserReceiptRepo) GetLatestOffset

func (tl *UserReceiptRepo) GetLatestOffset(ctx context.Context, userID, roomID string) int64

func (*UserReceiptRepo) GetLatestReceipt

func (tl *UserReceiptRepo) GetLatestReceipt(ctx context.Context, userID, roomID string) []byte

func (*UserReceiptRepo) LoadHistory

func (tl *UserReceiptRepo) LoadHistory(ctx context.Context, userID, roomID string, sync bool)

func (*UserReceiptRepo) SetMonitor

func (tl *UserReceiptRepo) SetMonitor(queryHitCounter mon.LabeledCounter)

func (*UserReceiptRepo) SetPersist

func (tl *UserReceiptRepo) SetPersist(db model.SyncAPIDatabase)

type UserTimeLineRepo

type UserTimeLineRepo struct {
	Idg *uid.UidGenerator
	// contains filtered or unexported fields
}

func NewUserTimeLineRepo

func NewUserTimeLineRepo(
	idg *uid.UidGenerator,
) *UserTimeLineRepo

func (*UserTimeLineRepo) AddFriendShip

func (tl *UserTimeLineRepo) AddFriendShip(userID, friend string) (hasLoad, hasFriendship bool)

func (*UserTimeLineRepo) AddP2PEv

func (tl *UserTimeLineRepo) AddP2PEv(ctx context.Context, ev *gomatrixserverlib.ClientEvent, user string)

func (*UserTimeLineRepo) CheckIsJoinRoom

func (tl *UserTimeLineRepo) CheckIsJoinRoom(ctx context.Context, user, room string) (isJoin bool)

func (*UserTimeLineRepo) CheckUserLoadingReady

func (tl *UserTimeLineRepo) CheckUserLoadingReady(user string) bool

func (*UserTimeLineRepo) ExistsUserEventUpdate

func (tl *UserTimeLineRepo) ExistsUserEventUpdate(utl int64, user, device, traceId string) (bool, int64)

func (*UserTimeLineRepo) ExistsUserReceiptUpdate

func (tl *UserTimeLineRepo) ExistsUserReceiptUpdate(pos int64, user string) (bool, int64)

func (*UserTimeLineRepo) GetFriendShip

func (tl *UserTimeLineRepo) GetFriendShip(ctx context.Context, userID string, load bool) *sync.Map

func (*UserTimeLineRepo) GetInviteRoomOffset

func (tl *UserTimeLineRepo) GetInviteRoomOffset(roomID, user string) int64

func (*UserTimeLineRepo) GetInviteRooms

func (tl *UserTimeLineRepo) GetInviteRooms(ctx context.Context, user string) (*sync.Map, error)

func (*UserTimeLineRepo) GetJoinMembershipOffset

func (tl *UserTimeLineRepo) GetJoinMembershipOffset(user, roomID string) (offset int64)

func (*UserTimeLineRepo) GetJoinRoomOffset

func (tl *UserTimeLineRepo) GetJoinRoomOffset(roomID string) int64

func (*UserTimeLineRepo) GetJoinRooms

func (tl *UserTimeLineRepo) GetJoinRooms(ctx context.Context, user string) (*sync.Map, error)

func (*UserTimeLineRepo) GetLeaveRoomOffset

func (tl *UserTimeLineRepo) GetLeaveRoomOffset(roomID, user string) int64

func (*UserTimeLineRepo) GetLeaveRooms

func (tl *UserTimeLineRepo) GetLeaveRooms(ctx context.Context, user string) (*sync.Map, error)

func (*UserTimeLineRepo) GetNotJoinRoomLatestOffset

func (tl *UserTimeLineRepo) GetNotJoinRoomLatestOffset(roomID, user, membership string) int64

func (*UserTimeLineRepo) GetRoomOffset

func (tl *UserTimeLineRepo) GetRoomOffset(roomID, user, membership string) int64

func (*UserTimeLineRepo) GetUserCurRoom

func (tl *UserTimeLineRepo) GetUserCurRoom(user, device string) (room string)

func (*UserTimeLineRepo) GetUserLatestReceiptOffset

func (tl *UserTimeLineRepo) GetUserLatestReceiptOffset(ctx context.Context, user string, isHuman bool) int64

func (*UserTimeLineRepo) GetUserRoomMembership

func (tl *UserTimeLineRepo) GetUserRoomMembership(user, room string) string

func (*UserTimeLineRepo) LoadHistory

func (tl *UserTimeLineRepo) LoadHistory(ctx context.Context, user string, isHuman bool)

func (*UserTimeLineRepo) LoadToken

func (tl *UserTimeLineRepo) LoadToken(user, device string, utl int64) (int64, map[string]int64, error)

func (*UserTimeLineRepo) LoadUserFriendShip

func (tl *UserTimeLineRepo) LoadUserFriendShip(ctx context.Context, userID string)

func (*UserTimeLineRepo) SetCache

func (tl *UserTimeLineRepo) SetCache(cache service.Cache)

func (*UserTimeLineRepo) SetMonitor

func (tl *UserTimeLineRepo) SetMonitor(queryHitCounter mon.LabeledCounter)

func (*UserTimeLineRepo) SetPersist

func (tl *UserTimeLineRepo) SetPersist(db model.SyncAPIDatabase)

func (*UserTimeLineRepo) SetReceiptLatest

func (tl *UserTimeLineRepo) SetReceiptLatest(userID string, offset int64)

func (*UserTimeLineRepo) SetUserCurRoom

func (tl *UserTimeLineRepo) SetUserCurRoom(user, device, room string)

func (*UserTimeLineRepo) UpdateRoomOffset

func (tl *UserTimeLineRepo) UpdateRoomOffset(roomID string, offset int64)

func (*UserTimeLineRepo) UpdateToken

func (tl *UserTimeLineRepo) UpdateToken(user, device string, utl int64, roomOffsets map[string]int64) error

Jump to

Keyboard shortcuts

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