msc2836

package
v0.3.2 Latest Latest
Warning

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

Go to latest
Published: Dec 2, 2020 License: Apache-2.0 Imports: 19 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

func Enable

Enable this MSC nolint:gocyclo

Types

type DB

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

func (*DB) ChildrenForParent

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

func (*DB) StoreRelation

func (p *DB) StoreRelation(ctx context.Context, ev *gomatrixserverlib.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 *gomatrixserverlib.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)
}

func NewDatabase

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

NewDatabase loads the database for msc2836

type EventRelationshipRequest

type EventRelationshipRequest struct {
	EventID         string `json:"event_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"`
	AutoJoin        bool   `json:"auto_join"`
}

func NewEventRelationshipRequest

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

func (*EventRelationshipRequest) Defaults

func (r *EventRelationshipRequest) Defaults()

type EventRelationshipResponse

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

Jump to

Keyboard shortcuts

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