msc2836

package
v0.13.2 Latest Latest
Warning

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

Go to latest
Published: Aug 23, 2023 License: Apache-2.0 Imports: 25 Imported by: 4

Documentation

Overview

Package msc2836 'Threading' implements https://github.com/matrix-org/matrix-doc/pull/2836

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

Types

type DB

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

func (*DB) ChildMetadata added in v0.3.3

func (p *DB) ChildMetadata(ctx context.Context, eventID string) (count int, hash []byte, explored bool, err error)

func (*DB) ChildrenForParent

func (p *DB) ChildrenForParent(ctx context.Context, eventID, relType string, recentFirst bool) ([]eventInfo, error)

func (*DB) MarkChildrenExplored added in v0.3.3

func (p *DB) MarkChildrenExplored(ctx context.Context, eventID string) error

func (*DB) ParentForChild added in v0.3.3

func (p *DB) ParentForChild(ctx context.Context, eventID, relType string) (*eventInfo, error)

func (*DB) StoreRelation

func (p *DB) StoreRelation(ctx context.Context, ev *types.HeaderedEvent) error

func (*DB) UpdateChildMetadata added in v0.3.3

func (p *DB) UpdateChildMetadata(ctx context.Context, ev *types.HeaderedEvent) error

type Database

type Database interface {
	// StoreRelation stores the parent->child and child->parent relationship for later querying.
	// Also stores the event metadata e.g timestamp
	StoreRelation(ctx context.Context, ev *types.HeaderedEvent) error
	// ChildrenForParent returns the events who have the given `eventID` as an m.relationship with the
	// provided `relType`. The returned slice is sorted by origin_server_ts according to whether
	// `recentFirst` is true or false.
	ChildrenForParent(ctx context.Context, eventID, relType string, recentFirst bool) ([]eventInfo, error)
	// ParentForChild returns the parent event for the given child `eventID`. The eventInfo should be nil if
	// there is no parent for this child event, with no error. The parent eventInfo can be missing the
	// timestamp if the event is not known to the server.
	ParentForChild(ctx context.Context, eventID, relType string) (*eventInfo, error)
	// UpdateChildMetadata persists the children_count and children_hash from this event if and only if
	// the count is greater than what was previously there. If the count is updated, the event will be
	// updated to be unexplored.
	UpdateChildMetadata(ctx context.Context, ev *types.HeaderedEvent) error
	// ChildMetadata returns the children_count and children_hash for the event ID in question.
	// Also returns the `explored` flag, which is set to true when MarkChildrenExplored is called and is set
	// back to `false` when a larger count is inserted via UpdateChildMetadata.
	// Returns nil error if the event ID does not exist.
	ChildMetadata(ctx context.Context, eventID string) (count int, hash []byte, explored bool, err error)
	// MarkChildrenExplored sets the 'explored' flag on this event to `true`.
	MarkChildrenExplored(ctx context.Context, eventID string) error
}

func NewDatabase

func NewDatabase(conMan *sqlutil.Connections, dbOpts *config.DatabaseOptions) (Database, error)

NewDatabase loads the database for msc2836

type EventRelationshipRequest

type EventRelationshipRequest struct {
	EventID         string `json:"event_id"`
	RoomID          string `json:"room_id"`
	MaxDepth        int    `json:"max_depth"`
	MaxBreadth      int    `json:"max_breadth"`
	Limit           int    `json:"limit"`
	DepthFirst      bool   `json:"depth_first"`
	RecentFirst     bool   `json:"recent_first"`
	IncludeParent   bool   `json:"include_parent"`
	IncludeChildren bool   `json:"include_children"`
	Direction       string `json:"direction"`
	Batch           string `json:"batch"`
}

func NewEventRelationshipRequest

func NewEventRelationshipRequest(body io.Reader) (*EventRelationshipRequest, error)

func (*EventRelationshipRequest) Defaults

func (r *EventRelationshipRequest) Defaults()

type EventRelationshipResponse

type EventRelationshipResponse struct {
	Events    []synctypes.ClientEvent `json:"events"`
	NextBatch string                  `json:"next_batch"`
	Limited   bool                    `json:"limited"`
}

type MSC2836EventRelationshipsResponse added in v0.6.3

type MSC2836EventRelationshipsResponse struct {
	fclient.MSC2836EventRelationshipsResponse
	ParsedEvents    []gomatrixserverlib.PDU
	ParsedAuthChain []gomatrixserverlib.PDU
}

Jump to

Keyboard shortcuts

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