Documentation
¶
Index ¶
- Constants
- Variables
- func IsAuthEvent(eventType EventType) bool
- func IsPowerEvent(event *Event) bool
- type AuthResult
- type CreateEventContent
- type DAGGenerationMetrics
- type DAGTraversalMetrics
- type DAGType
- type Event
- type EventEnumType
- type EventID
- type EventIDNode
- type EventNode
- type EventQueue
- type EventType
- type ExperimentalEvent
- type GraphMetrics
- type LinearPowerDAG
- type MemberEventContent
- type PowerEventLinks
- type PowerEventNode
- type PowerLevel
- type PowerLevels
- type PowerLevelsEventContent
- type PreviousRoom
- type RawJSON
- type RoomDAG
- type RoomMode
- type RoomState
- type StateEventLinks
- type StateEventNode
- type TimelineEventLinks
- type TimelineEventNode
- type UserID
Constants ¶
View Source
const DefaultPowerLevel = 0
View Source
const EVENT_TYPE_CREATE = "m.room.create"
View Source
const EVENT_TYPE_JOIN_RULES = "m.room.join_rules"
View Source
const EVENT_TYPE_MEMBER = "m.room.member"
View Source
const EVENT_TYPE_POWER_LEVELS = "m.room.power_levels"
View Source
const EVENT_TYPE_SERVER_ACL = "m.room.server_acl"
View Source
const EVENT_TYPE_THIRD_PARTY_INVITE = "m.room.third_party_invite"
Variables ¶
View Source
var AuthEventTypes = map[string]struct{}{ EVENT_TYPE_CREATE: {}, EVENT_TYPE_JOIN_RULES: {}, EVENT_TYPE_MEMBER: {}, EVENT_TYPE_POWER_LEVELS: {}, EVENT_TYPE_THIRD_PARTY_INVITE: {}, }
Functions ¶
func IsAuthEvent ¶
func IsPowerEvent ¶
Types ¶
type AuthResult ¶
type AuthResult int64
const ( AuthReject AuthResult = iota AuthSoftFail AuthAccept )
func EventAuthExperimental ¶
func EventAuthExperimental(event *EventNode, powerDAG LinearPowerDAG) AuthResult
NOTE: The powerDAG input is the entirety of the linearized power DAG
type CreateEventContent ¶
type CreateEventContent struct {
Creator string `json:"creator"`
Federate *bool `json:"m.federate,omitempty"`
Predecessor PreviousRoom `json:"predecessor,omitempty"`
RoomVersion string `json:"room_version,omitempty"`
Type string `json:"type,omitempty"`
}
type DAGGenerationMetrics ¶
type DAGGenerationMetrics struct {
// contains filtered or unexported fields
}
type DAGTraversalMetrics ¶
type DAGTraversalMetrics struct {
// contains filtered or unexported fields
}
type Event ¶
type Event struct {
EventID string `json:"_event_id"`
RoomVersion string `json:"_room_version"`
AuthEvents []string `json:"auth_events"`
Content RawJSON `json:"content"`
Depth int64 `json:"depth"`
Hashes RawJSON `json:"hashes"`
OriginTS int64 `json:"origin_server_ts"`
PrevEvents []string `json:"prev_events"`
Redacts *string `json:"redacts,omitempty"`
RoomID string `json:"room_id"`
Sender string `json:"sender"`
Signatures RawJSON `json:"signatures,omitempty"`
StateKey *string `json:"state_key,omitempty"`
Type string `json:"type"`
Unsigned RawJSON `json:"unsigned,omitempty"`
MembershipContent *MemberEventContent
CreateContent *CreateEventContent
PowerLevelsContent *PowerLevelsEventContent
}
type EventEnumType ¶
type EventEnumType int64
const ( AuthEvent EventEnumType = iota StateEvent PowerEvent NewStateTimelineEvent )
type EventIDNode ¶
type EventQueue ¶
type EventQueue struct {
// contains filtered or unexported fields
}
func NewEventQueue ¶
func NewEventQueue() EventQueue
func (*EventQueue) AddChild ¶
func (e *EventQueue) AddChild(eventID EventID, event *EventNode, eventType EventEnumType)
func (*EventQueue) AddChildrenFromNode ¶
func (e *EventQueue) AddChildrenFromNode(event *EventNode, eventType EventEnumType)
func (*EventQueue) Pop ¶
func (e *EventQueue) Pop()
func (*EventQueue) Push ¶
func (e *EventQueue) Push(event *EventNode)
type ExperimentalEvent ¶
type ExperimentalEvent struct {
EventID string `json:"_event_id"`
RoomVersion string `json:"_room_version"`
AuthEvents []string `json:"auth_events"`
Content RawJSON `json:"content"`
Depth int64 `json:"depth"`
Hashes RawJSON `json:"hashes"`
OriginTS int64 `json:"origin_server_ts"`
PrevEvents []string `json:"prev_events"`
Redacts *string `json:"redacts,omitempty"`
RoomID string `json:"room_id"`
Sender string `json:"sender"`
Signatures RawJSON `json:"signatures,omitempty"`
StateKey *string `json:"state_key,omitempty"`
Type string `json:"type"`
Unsigned RawJSON `json:"unsigned,omitempty"`
}
type GraphMetrics ¶
type GraphMetrics struct {
// contains filtered or unexported fields
}
type LinearPowerDAG ¶
type LinearPowerDAG []*EventNode
type MemberEventContent ¶
type MemberEventContent struct {
Membership string `json:"membership"`
AvatarURL *string `json:"avatar_url,omitempty"`
DisplayName *string `json:"displayname,omitempty"`
IsDirect *bool `json:"is_direct,omitempty"`
JoinAuthorisedViaUsersServer *string `json:"join_authorised_via_users_server,omitempty"`
Reason *string `json:"reason,omitempty"`
ThirdPartyInvite *RawJSON `json:"third_party_invite,omitempty"`
}
type PowerEventLinks ¶
type PowerEventLinks struct {
PrevPowerEvent *PowerEventNode
}
type PowerEventNode ¶
type PowerEventNode *EventNode
type PowerLevel ¶
type PowerLevel int
type PowerLevels ¶
type PowerLevels struct {
Default PowerLevel
Users map[UserID]PowerLevel
}
type PowerLevelsEventContent ¶
type PreviousRoom ¶
type RawJSON ¶
type RawJSON []byte
func (RawJSON) MarshalJSON ¶
MarshalJSON implements the json.Marshaller interface using a value receiver. This means that RawJSON used as an embedded value will still encode correctly.
func (*RawJSON) UnmarshalJSON ¶
UnmarshalJSON implements the json.Unmarshaller interface using a pointer receiver.
type RoomDAG ¶
type RoomDAG struct {
// contains filtered or unexported fields
}
func NewRoomDAG ¶
func NewRoomDAG() RoomDAG
func ParseDAGFromFile ¶
func (*RoomDAG) CreatePowerDAGJSON ¶
func (*RoomDAG) EventCountByType ¶
func (*RoomDAG) EventsInFile ¶
func (*RoomDAG) IsDuplicate ¶
func (*RoomDAG) PrintMetrics ¶
func (d *RoomDAG) PrintMetrics()
func (*RoomDAG) TotalEvents ¶
type StateEventLinks ¶
type StateEventLinks struct {
PrevPowerEvent *PowerEventNode
PrevStateEvents []*StateEventNode
}
type StateEventNode ¶
type StateEventNode *EventNode
type TimelineEventLinks ¶
type TimelineEventLinks struct {
PrevPowerEvent *PowerEventNode
PrevTimelineEvents []*TimelineEventNode
}
type TimelineEventNode ¶
type TimelineEventNode *EventNode
Click to show internal directories.
Click to hide internal directories.