orchestrator

package
v0.13.0 Latest Latest
Warning

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

Go to latest
Published: Feb 21, 2021 License: BSD-3-Clause Imports: 21 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ITEMCACHE_SHARD_COUNT = 32
View Source
var VIEWMODELCACHE_SHARD_COUNT = 32
View Source
var VIEWMODELLISTCACHE_SHARD_COUNT = 32

Functions

func GetBaseURL

func GetBaseURL(route route.Route) string

func GetTypedItemURL

func GetTypedItemURL(route route.Route, urlType string) string

Types

type AliasIndexOrchestrator

type AliasIndexOrchestrator struct {
	*Orchestrator
}

AliasIndexOrchestrator provides alias index entries.

func (*AliasIndexOrchestrator) GetIndexEntries

func (orchestrator *AliasIndexOrchestrator) GetIndexEntries(hostname, prefix string) []viewmodel.Alias

GetIndexEntries returns a list of all alias index entry models.

type CacheUpdateCallback

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

CacheUpdateCallback is a wrapper model for cache update callback functions.

func (*CacheUpdateCallback) Execute

func (updateCallback *CacheUpdateCallback) Execute(route route.Route) (err error)

Execute safely executes the callback and return any error that occured during execution.

func (*CacheUpdateCallback) Name

func (updateCallback *CacheUpdateCallback) Name() string

Name returns the name of the callback.

func (*CacheUpdateCallback) String

func (updateCallback *CacheUpdateCallback) String() string

String returns a string representation of the current CacheUpdateCallback.

func (*CacheUpdateCallback) UpdateType

func (updateCallback *CacheUpdateCallback) UpdateType() UpdateType

UpdateType returns the type of the callback.

type ConcurrentItemMapShared

type ConcurrentItemMapShared struct {
	sync.RWMutex // Read Write mutex, guards access to internal map.
	// contains filtered or unexported fields
}

type ConcurrentViewModelListMapShared

type ConcurrentViewModelListMapShared struct {
	sync.RWMutex // Read Write mutex, guards access to internal map.
	// contains filtered or unexported fields
}

type ConcurrentViewModelMapShared

type ConcurrentViewModelMapShared struct {
	sync.RWMutex // Read Write mutex, guards access to internal map.
	// contains filtered or unexported fields
}

type ConversionModelOrchestrator

type ConversionModelOrchestrator struct {
	*Orchestrator
	// contains filtered or unexported fields
}

func (*ConversionModelOrchestrator) GetConversionModel

func (orchestrator *ConversionModelOrchestrator) GetConversionModel(baseURL string, route route.Route) (model viewmodel.ConversionModel, found bool)

type Factory

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

func NewFactory

func NewFactory(logger logger.Logger, config config.Config, repository dataaccess.Repository, parser parser.Parser, converter converter.Converter, webPathProvider webpaths.WebPathProvider) *Factory

func (*Factory) NewAliasIndexOrchestrator

func (factory *Factory) NewAliasIndexOrchestrator() *AliasIndexOrchestrator

NewAliasIndexOrchestrator creates a new alias-index orchestrator.

func (*Factory) NewConversionModelOrchestrator

func (factory *Factory) NewConversionModelOrchestrator() *ConversionModelOrchestrator

func (*Factory) NewFeedOrchestrator

func (factory *Factory) NewFeedOrchestrator() *FeedOrchestrator

func (*Factory) NewFileOrchestrator

func (factory *Factory) NewFileOrchestrator() *FileOrchestrator

func (*Factory) NewNavigationOrchestrator

func (factory *Factory) NewNavigationOrchestrator() *NavigationOrchestrator

func (*Factory) NewOpenSearchDescriptionOrchestrator

func (factory *Factory) NewOpenSearchDescriptionOrchestrator() *OpenSearchDescriptionOrchestrator

func (*Factory) NewSearchOrchestrator

func (factory *Factory) NewSearchOrchestrator() *SearchOrchestrator

func (*Factory) NewSitemapOrchestrator

func (factory *Factory) NewSitemapOrchestrator() *SitemapOrchestrator

func (*Factory) NewTagsOrchestrator

func (factory *Factory) NewTagsOrchestrator() *TagsOrchestrator

func (*Factory) NewTitlesOrchestrator

func (factory *Factory) NewTitlesOrchestrator() *TitlesOrchestrator

func (*Factory) NewTypeAheadOrchestrator

func (factory *Factory) NewTypeAheadOrchestrator() *TypeAheadOrchestrator

func (*Factory) NewUpdateOrchestrator

func (factory *Factory) NewUpdateOrchestrator() *UpdateOrchestrator

func (*Factory) NewViewModelOrchestrator

func (factory *Factory) NewViewModelOrchestrator() *ViewModelOrchestrator

func (*Factory) NewXMLSitemapOrchestrator

func (factory *Factory) NewXMLSitemapOrchestrator() *XmlSitemapOrchestrator

type FeedOrchestrator

type FeedOrchestrator struct {
	*Orchestrator
}

A FeedOrchestrator provides feed models.

func (*FeedOrchestrator) GetFeed

func (orchestrator *FeedOrchestrator) GetFeed(baseURL string, itemsPerPage, page int) (viewmodel.Feed, error)

GetFeed returns a feed model for the given base URL, items per page and page.

type FileOrchestrator

type FileOrchestrator struct {
	*Orchestrator
}

func (*FileOrchestrator) GetFile

func (orchestrator *FileOrchestrator) GetFile(fileRoute route.Route) (fileModel viewmodel.File, found bool)

func (*FileOrchestrator) GetFileContentProvider

func (orchestrator *FileOrchestrator) GetFileContentProvider(fileRoute route.Route) content.ContentProviderInterface

func (*FileOrchestrator) GetFiles

func (orchestrator *FileOrchestrator) GetFiles(itemRoute route.Route) []viewmodel.File

func (*FileOrchestrator) GetImages

func (orchestrator *FileOrchestrator) GetImages(itemRoute route.Route) []viewmodel.Image

type ItemCache

type ItemCache []*ConcurrentItemMapShared

A "thread" safe map of type string:*model.Item. To avoid lock bottlenecks this map is dived to several (ITEMCACHE_SHARD_COUNT) map shards.

func (ItemCache) Count

func (m ItemCache) Count() int

Returns the number of elements within the map.

func (ItemCache) Get

func (m ItemCache) Get(key string) (*model.Item, bool)

Retrieves an element from map under given key.

func (ItemCache) GetShard

func (m ItemCache) GetShard(key string) *ConcurrentItemMapShared

Returns shard under given key

func (*ItemCache) Has

func (m *ItemCache) Has(key string) bool

Looks up an item under specified key

func (*ItemCache) IsEmpty

func (m *ItemCache) IsEmpty() bool

Checks if map is empty.

func (ItemCache) Iter

func (m ItemCache) Iter() <-chan ItemCacheTuple

Returns an iterator which could be used in a for range loop.

func (ItemCache) IterBuffered

func (m ItemCache) IterBuffered() <-chan ItemCacheTuple

Returns a buffered iterator which could be used in a for range loop.

func (*ItemCache) Remove

func (m *ItemCache) Remove(key string)

Removes an element from the map.

func (*ItemCache) Set

func (m *ItemCache) Set(key string, value *model.Item)

Sets the given value under the specified key.

type ItemCacheTuple

type ItemCacheTuple struct {
	Key string
	Val *model.Item
}

Used by the Iter & IterBuffered functions to wrap two variables together over a channel,

type NavigationOrchestrator struct {
	*Orchestrator
	// contains filtered or unexported fields
}
func (orchestrator *NavigationOrchestrator) GetBreadcrumbNavigation(route route.Route) viewmodel.BreadcrumbNavigation
func (orchestrator *NavigationOrchestrator) GetItemNavigation(route route.Route) viewmodel.ItemNavigation
func (orchestrator *NavigationOrchestrator) GetToplevelNavigation() viewmodel.ToplevelNavigation

type OpenSearchDescriptionOrchestrator

type OpenSearchDescriptionOrchestrator struct {
	*Orchestrator
}

func (*OpenSearchDescriptionOrchestrator) GetDescriptionModel

func (orchestrator *OpenSearchDescriptionOrchestrator) GetDescriptionModel(hostname string) viewmodel.OpenSearchDescription

type Orchestrator

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

func (*Orchestrator) GetPageTitle

func (orchestrator *Orchestrator) GetPageTitle(headline string) string

Get the full-page title for a given headline.

func (*Orchestrator) ItemExists

func (orchestrator *Orchestrator) ItemExists(route route.Route) bool

func (*Orchestrator) Subscribe

func (orchestrator *Orchestrator) Subscribe(update chan Update)

func (*Orchestrator) UpdateCache

func (orchestrator *Orchestrator) UpdateCache(dataaccessLayerUpdate dataaccess.Update)

Update all caches

type SearchOrchestrator

type SearchOrchestrator struct {
	*Orchestrator
}

func (*SearchOrchestrator) GetSearchResults

func (orchestrator *SearchOrchestrator) GetSearchResults(keywords string, page int) viewmodel.SearchResults

type SitemapOrchestrator

type SitemapOrchestrator struct {
	*Orchestrator
	// contains filtered or unexported fields
}

func (*SitemapOrchestrator) GetSitemap

func (orchestrator *SitemapOrchestrator) GetSitemap() viewmodel.SitemapEntry

type TagsOrchestrator

type TagsOrchestrator struct {
	*Orchestrator
	// contains filtered or unexported fields
}

func (*TagsOrchestrator) GetTagCloud

func (orchestrator *TagsOrchestrator) GetTagCloud() viewmodel.TagCloud

GetTagCloud returns the latest tag cloud viewmodel.

func (*TagsOrchestrator) GetTags

func (orchestrator *TagsOrchestrator) GetTags() []viewmodel.Tag

GetTags returns a list of all known tag models.

type TitlesOrchestrator

type TitlesOrchestrator struct {
	*Orchestrator
}

func (*TitlesOrchestrator) GetTitles

func (orchestrator *TitlesOrchestrator) GetTitles() []viewmodel.Title

type TypeAheadOrchestrator

type TypeAheadOrchestrator struct {
	*Orchestrator
}

func (*TypeAheadOrchestrator) GetSuggestions

func (orchestrator *TypeAheadOrchestrator) GetSuggestions(keywords string) []viewmodel.TypeAhead

type Update

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

func NewUpdate

func NewUpdate(updateType UpdateType, route route.Route) Update

func (*Update) Route

func (update *Update) Route() route.Route

func (*Update) String

func (update *Update) String() string

func (*Update) Type

func (update *Update) Type() UpdateType

type UpdateOrchestrator

type UpdateOrchestrator struct {
	*Orchestrator
	// contains filtered or unexported fields
}

func (*UpdateOrchestrator) GetUpdatedModel

func (orchestrator *UpdateOrchestrator) GetUpdatedModel(itemRoute route.Route) (viewModel viewmodel.Model, found bool)

func (*UpdateOrchestrator) StartWatching

func (orchestrator *UpdateOrchestrator) StartWatching(route route.Route)

func (*UpdateOrchestrator) StopWatching

func (orchestrator *UpdateOrchestrator) StopWatching(route route.Route)

type UpdateType

type UpdateType int
const (
	UpdateTypeUnchanged UpdateType = iota
	UpdateTypeNew
	UpdateTypeModified
	UpdateTypeDeleted
)

func (UpdateType) String

func (updateType UpdateType) String() string

type ViewModelCache

type ViewModelCache []*ConcurrentViewModelMapShared

A "thread" safe map of type string:viewmodel.Model. To avoid lock bottlenecks this map is dived to several (VIEWMODELCACHE_SHARD_COUNT) map shards.

func (ViewModelCache) Count

func (m ViewModelCache) Count() int

Returns the number of elements within the map.

func (ViewModelCache) Get

func (m ViewModelCache) Get(key string) (viewmodel.Model, bool)

Retrieves an element from map under given key.

func (ViewModelCache) GetShard

Returns shard under given key

func (*ViewModelCache) Has

func (m *ViewModelCache) Has(key string) bool

Looks up an item under specified key

func (*ViewModelCache) IsEmpty

func (m *ViewModelCache) IsEmpty() bool

Checks if map is empty.

func (ViewModelCache) Iter

func (m ViewModelCache) Iter() <-chan ViewModelCacheTuple

Returns an iterator which could be used in a for range loop.

func (ViewModelCache) IterBuffered

func (m ViewModelCache) IterBuffered() <-chan ViewModelCacheTuple

Returns a buffered iterator which could be used in a for range loop.

func (*ViewModelCache) Remove

func (m *ViewModelCache) Remove(key string)

Removes an element from the map.

func (*ViewModelCache) Set

func (m *ViewModelCache) Set(key string, value viewmodel.Model)

Sets the given value under the specified key.

type ViewModelCacheTuple

type ViewModelCacheTuple struct {
	Key string
	Val viewmodel.Model
}

Used by the Iter & IterBuffered functions to wrap two variables together over a channel,

type ViewModelListCache

type ViewModelListCache []*ConcurrentViewModelListMapShared

A "thread" safe map of type string:[]viewmodel.Model. To avoid lock bottlenecks this map is dived to several (VIEWMODELLISTCACHE_SHARD_COUNT) map shards.

func (ViewModelListCache) Count

func (m ViewModelListCache) Count() int

Returns the number of elements within the map.

func (ViewModelListCache) Get

func (m ViewModelListCache) Get(key string) ([]viewmodel.Model, bool)

Retrieves an element from map under given key.

func (ViewModelListCache) GetShard

Returns shard under given key

func (*ViewModelListCache) Has

func (m *ViewModelListCache) Has(key string) bool

Looks up an item under specified key

func (*ViewModelListCache) IsEmpty

func (m *ViewModelListCache) IsEmpty() bool

Checks if map is empty.

func (ViewModelListCache) Iter

Returns an iterator which could be used in a for range loop.

func (ViewModelListCache) IterBuffered

func (m ViewModelListCache) IterBuffered() <-chan ViewModelListCacheTuple

Returns a buffered iterator which could be used in a for range loop.

func (*ViewModelListCache) Remove

func (m *ViewModelListCache) Remove(key string)

Removes an element from the map.

func (*ViewModelListCache) Set

func (m *ViewModelListCache) Set(key string, value []viewmodel.Model)

Sets the given value under the specified key.

type ViewModelListCacheTuple

type ViewModelListCacheTuple struct {
	Key string
	Val []viewmodel.Model
}

Used by the Iter & IterBuffered functions to wrap two variables together over a channel,

type ViewModelOrchestrator

type ViewModelOrchestrator struct {
	*Orchestrator
	// contains filtered or unexported fields
}

func (*ViewModelOrchestrator) GetFullViewModel

func (orchestrator *ViewModelOrchestrator) GetFullViewModel(itemRoute route.Route) (viewmodel.Model, bool)

GetFullViewModel returns a fully-initialized viewmodel for the given route.

func (*ViewModelOrchestrator) GetLatest

func (orchestrator *ViewModelOrchestrator) GetLatest(itemRoute route.Route, pageSize, page int) (latest []viewmodel.Model, found bool)

GetLatest returns the latest items (sorted by creation date) for the given route.

func (*ViewModelOrchestrator) GetViewModel

func (orchestrator *ViewModelOrchestrator) GetViewModel(itemRoute route.Route) (viewModel viewmodel.Model, found bool)

func (*ViewModelOrchestrator) GetViewModelByAlias

func (orchestrator *ViewModelOrchestrator) GetViewModelByAlias(alias string) (viewModel viewmodel.Model, found bool)

GetViewModelByAlias returns the viewmodel by its alias.

type XmlSitemapOrchestrator

type XmlSitemapOrchestrator struct {
	*Orchestrator
}

func (*XmlSitemapOrchestrator) GetSitemapEntires

func (orchestrator *XmlSitemapOrchestrator) GetSitemapEntires(hostname string) []viewmodel.XmlSitemapEntry

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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