Documentation ¶
Index ¶
- Variables
- type Action
- type ActionArgument
- type ActionArgumentFactory
- type ActionArgumentType
- type ActionArguments
- type ActionFactory
- type ActionType
- type Content
- type ContentBy
- type ContentFactory
- type ContentKeywordExtractionInput
- type ContentStore
- func (store *ContentStore) Count() int
- func (store *ContentStore) Describe() []*Content
- func (store *ContentStore) Get(id ID) *Content
- func (store *ContentStore) GetAllContentIDs() []ID
- func (store *ContentStore) GetAnyContentID() ID
- func (store *ContentStore) GetMany(ids []ID) []*Content
- func (store *ContentStore) RestoreFromSnapshot(path, filename string) error
- func (store *ContentStore) Snapshot(path, filename string) error
- func (store *ContentStore) Upsert(content *Content)
- type ContentStoreFactory
- type ID
- type Index
- func (index *Index) Describe() []*IndexNodeDescription
- func (index *Index) GetForTopics(topics Topics) [][]ID
- func (index *Index) Index(content *Content)
- func (index *Index) Reindex(old, new *Content)
- func (index *Index) Remove(content *Content)
- func (index *Index) RestoreFromSnapshot(path, filename string) error
- func (index *Index) Snapshot(path, filename string) error
- type IndexFactory
- type IndexNodeDescription
- type Interest
- type Keyword
- type Keywords
- type Net
- type NetConfig
- type NetDescription
- type NetFactory
- type Profile
- type ProfileDescription
- type ProfileFactory
- type ProfileStore
- func (store *ProfileStore) Delete(id ID)
- func (store *ProfileStore) Describe() []*ProfileDescription
- func (store *ProfileStore) Get(id ID) *Profile
- func (store *ProfileStore) RestoreFromSnapshot(path, filename string) error
- func (store *ProfileStore) Save(action *Action)
- func (store *ProfileStore) Snapshot(path, filename string) error
- type ProfileStoreFactory
- type SelectionCacheInfo
- type Topic
- type TopicFactory
- type TopicInterest
- type TopicInterestBy
- type TopicInterestDescription
- type TopicInterestFactory
- type TopicInterests
- type Topics
- type Trend
- type TrendBy
- type TrendDescription
- type TrendStore
- func (store *TrendStore) Describe() []*TrendDescription
- func (store *TrendStore) GetTopN(n int) Topics
- func (store *TrendStore) Register(topics Topics, popularity float64)
- func (store *TrendStore) RestoreFromSnapshot(path, filename string) error
- func (store *TrendStore) Snapshot(path, filename string) error
- func (store *TrendStore) Unregister(topics Topics, popularity float64)
- type TrendStoreFactory
- type WordCount
- type WordCountBy
Constants ¶
This section is empty.
Variables ¶
var ActionArgumentTypes = struct { Unknown ActionArgumentType Integer ActionArgumentType String ActionArgumentType Float ActionArgumentType }{ Unknown: action_argument_type_unknown, Integer: action_argument_type_integer, String: action_argument_type_string, Float: action_argument_type_float, }
var ActionTypes = struct { None ActionType Read ActionType Upvote ActionType Downvote ActionType }{ None: action_none, Read: action_read, Upvote: action_upvote, Downvote: action_downvote, }
var ContentKeywordExtractor = keywordExtractor{}
var Errors = struct { NotImplemented error ContentNotFound error ProfileNotFound error }{ NotImplemented: errors.New("Not implemented."), ContentNotFound: errors.New("Content not found in content store."), ProfileNotFound: errors.New("Profile not found in profile store."), }
var Object = struct { Topic TopicFactory Content ContentFactory ContentStore ContentStoreFactory TopicInterest TopicInterestFactory Profile ProfileFactory ProfileStore ProfileStoreFactory Index IndexFactory Net NetFactory Action ActionFactory ActionArgument ActionArgumentFactory TrendStore TrendStoreFactory }{ Topic: TopicFactory{}, Content: ContentFactory{}, ContentStore: ContentStoreFactory{}, TopicInterest: TopicInterestFactory{}, Profile: ProfileFactory{}, ProfileStore: ProfileStoreFactory{}, Index: IndexFactory{}, Net: NetFactory{}, Action: ActionFactory{}, ActionArgument: ActionArgumentFactory{}, TrendStore: TrendStoreFactory{}, }
registry of all object factories
Functions ¶
This section is empty.
Types ¶
type Action ¶
type Action struct { ProfileID ID `json:"profileID"` ContentID ID `json:"contentID"` Content *Content Type ActionType `json:"type"` Arguments ActionArguments `json:"arguments"` Timestamp time.Time `json:"timestamp"` }
type ActionArgument ¶
type ActionArgument struct { Name string `json:"name"` Type ActionArgumentType `json:"type"` Value interface{} `json:"value"` }
func (*ActionArgument) Clone ¶
func (arg *ActionArgument) Clone() *ActionArgument
func (*ActionArgument) GetValueInteger ¶
func (arg *ActionArgument) GetValueInteger() int
type ActionArgumentFactory ¶
type ActionArgumentFactory struct{}
func (ActionArgumentFactory) New ¶
func (factory ActionArgumentFactory) New(name string, argType ActionArgumentType, value interface{}) *ActionArgument
type ActionArgumentType ¶
type ActionArgumentType uint8
type ActionArguments ¶
type ActionArguments []*ActionArgument
func (ActionArguments) Clone ¶
func (args ActionArguments) Clone() ActionArguments
func (ActionArguments) GetArgumentByName ¶
func (args ActionArguments) GetArgumentByName(name string) *ActionArgument
type ActionFactory ¶
type ActionFactory struct{}
func (ActionFactory) New ¶
func (factory ActionFactory) New(profileID, contentID ID, actionType ActionType, timestamp time.Time, args ActionArguments) *Action
type ActionType ¶
type ActionType uint8
type Content ¶
type Content struct { ID ID `json:"id"` Keywords Keywords `json:"keywords"` CreatedAt time.Time `json:"createdAt"` Quality float64 `json:"quality"` Popularity float64 `json:"popularity"` // virtual attribute Age time.Time `json:"age"` }
Content object contains information pertinent to content being indexed by ContNet.
type ContentFactory ¶
type ContentFactory struct{}
type ContentStore ¶
func (*ContentStore) Count ¶
func (store *ContentStore) Count() int
func (*ContentStore) Describe ¶
func (store *ContentStore) Describe() []*Content
func (*ContentStore) Get ¶
func (store *ContentStore) Get(id ID) *Content
func (*ContentStore) GetAllContentIDs ¶
func (store *ContentStore) GetAllContentIDs() []ID
func (*ContentStore) GetAnyContentID ¶
func (store *ContentStore) GetAnyContentID() ID
I know this relies on the fact that range order is UNSPECIFIED and thus behaves quasi-randomly..
func (*ContentStore) GetMany ¶
func (store *ContentStore) GetMany(ids []ID) []*Content
func (*ContentStore) RestoreFromSnapshot ¶
func (store *ContentStore) RestoreFromSnapshot(path, filename string) error
func (*ContentStore) Snapshot ¶
func (store *ContentStore) Snapshot(path, filename string) error
func (*ContentStore) Upsert ¶
func (store *ContentStore) Upsert(content *Content)
type ContentStoreFactory ¶
type ContentStoreFactory struct{}
func (ContentStoreFactory) New ¶
func (factory ContentStoreFactory) New(config *NetConfig, bus *EventBus.EventBus) *ContentStore
type Index ¶
func (*Index) Describe ¶
func (index *Index) Describe() []*IndexNodeDescription
func (*Index) GetForTopics ¶
func (*Index) RestoreFromSnapshot ¶
type IndexFactory ¶
type IndexFactory struct{}
func (IndexFactory) New ¶
func (factory IndexFactory) New(config *NetConfig, bus *EventBus.EventBus, contentStore *ContentStore) *Index
type IndexNodeDescription ¶
type Interest ¶
type Interest float64
Interest is a floating point value that represents the level of user's interest.
type Keyword ¶
type Keyword uint32
Keyword is represented by its unique id which is of type unsigned int32.
type Net ¶
func (*Net) Describe ¶
func (net *Net) Describe() *NetDescription
func (*Net) SaveAction ¶
Attempts to update network object with action for profile specified.
func (*Net) SaveContent ¶
Attempts to update network object with content specified. If content did not exist, it is added to the network. If content did exist, it is updated.
type NetDescription ¶
type NetDescription struct { Contents []*Content Index []*IndexNodeDescription Profiles []*ProfileDescription Trends []*TrendDescription }
type NetFactory ¶
type NetFactory struct{}
func (NetFactory) New ¶
func (factory NetFactory) New(config *NetConfig) *Net
type Profile ¶
type Profile struct { ID ID TopicInterests TopicInterests }
Profile contains information about topic interests for specified content consumer.
func (*Profile) Describe ¶
func (profile *Profile) Describe() *ProfileDescription
func (*Profile) SaveAction ¶
Thread-safe profile object update with action
type ProfileDescription ¶
type ProfileDescription struct { ID ID `json:"id"` TopicInterests []*TopicInterestDescription `json:"topicInterests"` }
type ProfileFactory ¶
type ProfileFactory struct{}
func (ProfileFactory) New ¶
func (factory ProfileFactory) New(id ID, topicInterests TopicInterests) *Profile
Creates new Profile object
type ProfileStore ¶
func (*ProfileStore) Delete ¶
func (store *ProfileStore) Delete(id ID)
func (*ProfileStore) Describe ¶
func (store *ProfileStore) Describe() []*ProfileDescription
func (*ProfileStore) Get ¶
func (store *ProfileStore) Get(id ID) *Profile
func (*ProfileStore) RestoreFromSnapshot ¶
func (store *ProfileStore) RestoreFromSnapshot(path, filename string) error
func (*ProfileStore) Save ¶
func (store *ProfileStore) Save(action *Action)
func (*ProfileStore) Snapshot ¶
func (store *ProfileStore) Snapshot(path, filename string) error
type ProfileStoreFactory ¶
type ProfileStoreFactory struct{}
func (ProfileStoreFactory) New ¶
func (factory ProfileStoreFactory) New() *ProfileStore
type SelectionCacheInfo ¶
type Topic ¶
type Topic uint64
Topic is represented by a hash of content keywords.
func (Topic) GetKeywords ¶
Returns keywords from topic object. Keywords are always ordered in ASC.
type TopicFactory ¶
type TopicFactory struct{}
func (TopicFactory) New ¶
func (factory TopicFactory) New(k1, k2 Keyword) *Topic
Creates new Topic from keywords specified.
type TopicInterest ¶
TopicInterest is a structure that represents the level of user's interest for specified topic.
func (*TopicInterest) Clone ¶
func (topicInterest *TopicInterest) Clone() *TopicInterest
func (*TopicInterest) Describe ¶
func (topicInterest *TopicInterest) Describe() *TopicInterestDescription
type TopicInterestBy ¶
type TopicInterestBy func(t1, t2 *TopicInterest) bool
function that defines ordering between trend objects
func (TopicInterestBy) Sort ¶
func (topicInterestBy TopicInterestBy) Sort(topicInterests TopicInterests)
method on the function type, sorts the argument slice according to the function
type TopicInterestFactory ¶
type TopicInterestFactory struct{}
func (*TopicInterestFactory) New ¶
func (factory *TopicInterestFactory) New(topic Topic, cumulativeInterest Interest) *TopicInterest
type TopicInterests ¶
type TopicInterests []*TopicInterest
Alias for a slice of pointers to topic interests.
func (TopicInterests) Apply ¶
func (topicInterests TopicInterests) Apply(topics Topics, value float64) TopicInterests
value - between -1.0 and 1.0
func (TopicInterests) Clone ¶
func (topicInterests TopicInterests) Clone() TopicInterests
func (TopicInterests) Describe ¶
func (topicInterests TopicInterests) Describe() []*TopicInterestDescription
type TrendDescription ¶
type TrendStore ¶
func (*TrendStore) Describe ¶
func (store *TrendStore) Describe() []*TrendDescription
func (*TrendStore) GetTopN ¶
func (store *TrendStore) GetTopN(n int) Topics
func (*TrendStore) Register ¶
func (store *TrendStore) Register(topics Topics, popularity float64)
func (*TrendStore) RestoreFromSnapshot ¶
func (store *TrendStore) RestoreFromSnapshot(path, filename string) error
func (*TrendStore) Snapshot ¶
func (store *TrendStore) Snapshot(path, filename string) error
func (*TrendStore) Unregister ¶
func (store *TrendStore) Unregister(topics Topics, popularity float64)
type TrendStoreFactory ¶
type TrendStoreFactory struct{}
func (TrendStoreFactory) New ¶
func (factory TrendStoreFactory) New(bus *EventBus.EventBus) *TrendStore
type WordCountBy ¶
function that defines ordering between content objects
func (WordCountBy) Sort ¶
func (wordCountBy WordCountBy) Sort(wordCounts []*WordCount)
method on the function type, sorts the argument slice according to the function