Documentation
¶
Overview ¶
Package dict has the implementation of the dictionary api for the platform
Index ¶
- Constants
- Variables
- func Datasets(in chan DatasetRequest)
- func SendDatasetToChannel(ch chan DatasetRequest, req DatasetRequest)
- func SetDefaultDatasetAggregator(agg DatasetAggregator)
- func SystemDICT() interpreter.DICT
- type DAgg
- type Dataset
- type DatasetAggregator
- type DatasetRequest
- type DatasetRequestType
Constants ¶
const DatasetClearCheckInterval = time.Minute * 20
DatasetClearCheckInterval is the interval after which the datatset removal check has to run
const DatasetExpiry = time.Hour * 4
DatasetExpiry is the expiry time after which the datatset expiries without any active usage
Variables ¶
var DatasetInputChannel chan DatasetRequest
DatasetInputChannel is the input channel to communicate with the cache
Functions ¶
func Datasets ¶
func Datasets(in chan DatasetRequest)
Datasets is the cache providing the datatsets. When a dataset is updated, coresponding users who all have access to that dataset get their DICTs updated automatically
func SendDatasetToChannel ¶
func SendDatasetToChannel(ch chan DatasetRequest, req DatasetRequest)
SendDatasetToChannel sends a dataset request to the channel. This function is to be used with go routines so that datasets isn't blocked by the requests
func SetDefaultDatasetAggregator ¶
func SetDefaultDatasetAggregator(agg DatasetAggregator)
SetDefaultDatasetAggregator sets the default aggregator as the passed param
func SystemDICT ¶
func SystemDICT() interpreter.DICT
SystemDICT returns the system dictionary available for all the users
Types ¶
type DAgg ¶
type DAgg struct {
// contains filtered or unexported fields
}
DAgg is the dict aggregator for getting the dict from the database
type Dataset ¶
type Dataset struct { D map[string]interpreter.Token LastUsed time.Time }
Dataset is the dataset instance having the node tokens
type DatasetAggregator ¶
DatasetAggregator is the aggregator to get the dict from a service or database
type DatasetRequest ¶
type DatasetRequest struct { //ID of the dataset ID string //SubscribeID is the id which subscribes to the dataset SubscribeID string //Type is the type of the dictionary request. It can have Add, Get, Remove Type DatasetRequestType //Dataset has the tokens mapped to the token string for the dataset Dataset Dataset //Valid indicates that the dict is valid. During get requests, if valid is false then cache couldn't find the dict Valid bool //Out channel for sending response to the requester Out chan DatasetRequest }
DatasetRequest can be used to make a request to get the dataset cache
type DatasetRequestType ¶
type DatasetRequestType uint
DatasetRequestType is the type of the request for the dataset
const ( //DatasetUpdate comes to update and datatset and update corresponding subscribed ids DatasetUpdate DatasetRequestType = 1 //DatasetGet returns the dataset of a given id DatasetGet DatasetRequestType = 2 //DatasetRemove to remove the dataset from the cache DatasetRemove DatasetRequestType = 3 )