timeline

package
v1.6.3 Latest Latest
Warning

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

Go to latest
Published: Dec 23, 2024 License: MIT Imports: 27 Imported by: 0

Documentation

Overview

Package timeline is for handling concurrent timeline object

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewService

func NewService(
	repository Repository,
	entity core.EntityService,
	domain core.DomainService,
	semanticid core.SemanticIDService,
	subscription core.SubscriptionService,
	policy core.PolicyService,
	config core.Config,
) core.TimelineService

NewService creates a new service

Types

type Handler

type Handler interface {
	Get(c echo.Context) error
	Recent(c echo.Context) error
	Range(c echo.Context) error
	List(c echo.Context) error
	ListMine(c echo.Context) error
	GetChunks(c echo.Context) error
	Realtime(c echo.Context) error
	Query(c echo.Context) error

	GetChunkItr(c echo.Context) error
	GetChunkBody(c echo.Context) error
	Retracted(c echo.Context) error
}

Handler is the interface for handling HTTP requests

func NewHandler

func NewHandler(service core.TimelineService) Handler

NewHandler creates a new handler

type Keeper

type Keeper interface {
	Start(ctx context.Context)
	GetRemoteSubs() []string
	GetCurrentSubs(ctx context.Context) []string
	GetMetrics() map[string]int64
}

func NewKeeper

func NewKeeper(rdb *redis.Client, mc *memcache.Client, client client.Client, config core.Config) Keeper

type PriorityQueue

type PriorityQueue []*QueueItem

func (PriorityQueue) Len

func (pq PriorityQueue) Len() int

func (PriorityQueue) Less

func (pq PriorityQueue) Less(i, j int) bool

func (*PriorityQueue) Pop

func (pq *PriorityQueue) Pop() interface{}

func (*PriorityQueue) Push

func (pq *PriorityQueue) Push(x interface{})

func (PriorityQueue) Swap

func (pq PriorityQueue) Swap(i, j int)

type QueueItem

type QueueItem struct {
	Timeline string
	Epoch    string
	Item     core.TimelineItem
	Index    int
}

type Repository

type Repository interface {
	GetTimeline(ctx context.Context, key string) (core.Timeline, error)
	GetTimelineFromRemote(ctx context.Context, host string, key string) (core.Timeline, error)
	UpsertTimeline(ctx context.Context, timeline core.Timeline) (core.Timeline, error)
	DeleteTimeline(ctx context.Context, key string) error

	GetItem(ctx context.Context, timelineID string, objectID string) (core.TimelineItem, error)
	CreateItem(ctx context.Context, item core.TimelineItem) (core.TimelineItem, error)
	DeleteItem(ctx context.Context, timelineID string, objectID string) error
	DeleteItemByResourceID(ctx context.Context, resourceID string) error

	ListTimelineBySchema(ctx context.Context, schema string) ([]core.Timeline, error)
	ListTimelineByAuthor(ctx context.Context, author string) ([]core.Timeline, error)
	ListTimelineByAuthorOwned(ctx context.Context, author string) ([]core.Timeline, error)

	GetRecentItems(ctx context.Context, timelineID string, until time.Time, limit int) ([]core.TimelineItem, error)
	GetImmediateItems(ctx context.Context, timelineID string, since time.Time, limit int) ([]core.TimelineItem, error)

	PublishEvent(ctx context.Context, event core.Event) error

	ListTimelineSubscriptions(ctx context.Context) (map[string]int64, error)
	Count(ctx context.Context) (int64, error)

	Subscribe(ctx context.Context, channels []string, event chan<- core.Event) error

	SetNormalizationCache(ctx context.Context, timelineID string, value string) error
	GetNormalizationCache(ctx context.Context, timelineID string) (string, error)

	Query(ctx context.Context, timelineID, schema, owner, author string, until time.Time, limit int) ([]core.TimelineItem, error)

	LookupChunkItrs(ctx context.Context, timelines []string, epoch string) (map[string]string, error)
	LoadChunkBodies(ctx context.Context, query map[string]string) (map[string]core.Chunk, error)

	ListRecentlyRemovedItems(ctx context.Context, normalized []string) (map[string][]string, error)
	ListRecentlyRemovedItemsLocal(ctx context.Context, timelineIDs []string) (map[string][]string, error)

	GetMetrics() map[string]int64
}

Repository is timeline repository interface

func NewRepository

func NewRepository(db *gorm.DB, rdb *redis.Client, mc *memcache.Client, keeper Keeper, client client.Client, schema core.SchemaService, config core.Config) Repository

NewRepository creates a new timeline repository

type Request

type Request struct {
	Type     string   `json:"type"`
	Channels []string `json:"channels"`
}

Directories

Path Synopsis
Package mock_timeline is a generated GoMock package.
Package mock_timeline is a generated GoMock package.

Jump to

Keyboard shortcuts

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