Documentation
¶
Index ¶
- Constants
- type Advertisement
- type Database
- type Interval
- type MongoDb
- func (mongoDb *MongoDb) FindAdsWithObjects(ctx context.Context, objects []string) ([]Advertisement, error)
- func (mongoDb *MongoDb) GetAd(ctx context.Context, id string) (Advertisement, error)
- func (mongoDb *MongoDb) GetAllVideos(ctx context.Context) ([]Video, error)
- func (mongoDb *MongoDb) GetVideo(ctx context.Context, id string) (Video, error)
- func (mongoDb *MongoDb) GetVideoInference(ctx context.Context, id string) (VideoInference, error)
- func (mongoDb *MongoDb) InitializeVideoInference(ctx context.Context, id string) (bool, error)
- func (mongoDb *MongoDb) InsertAd(ctx context.Context, ad Advertisement) error
- func (mongoDb *MongoDb) InsertVideo(ctx context.Context, video Video) error
- func (mongoDb *MongoDb) InsertVideoInference(ctx context.Context, videoInference VideoInference) error
- func (mongoDb *MongoDb) UpdateVideoInference(ctx context.Context, videoInference VideoInference) error
- type Video
- type VideoInference
Constants ¶
const ( STATUS_PROCESSING = "PROCESSING" STATUS_COMPLETE = "COMPLETE" STATUS_FAILED = "FAILED" )
const ( MaxRetryCount = 10 SleepDuration = 10 VideoCollection = "Videos" AdCollection = "Advertisements" VideoInferenceCollection = "VideoInference" )
constants
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Advertisement ¶
Advertisement Struct
type Database ¶
type Database interface {
InsertVideo(context.Context, Video) error
GetVideo(context.Context, string) (Video, error)
GetAllVideos(context.Context) ([]Video, error)
InsertAd(context.Context, Advertisement) error
GetAd(context.Context, string) (Advertisement, error)
FindAdsWithObjects(context.Context, []string) ([]Advertisement, error)
InsertVideoInference(context.Context, VideoInference) error
UpdateVideoInference(context.Context, VideoInference) error
GetVideoInference(context.Context, string) (VideoInference, error)
InitializeVideoInference(context.Context, string) (bool, error)
}
Database Interface
func GetDatabaseClient ¶
func GetDatabaseClient(ctx context.Context, dbConfig config.DatabaseConfiguration) (Database, error)
GetDatabaseClient based on the configuration, any implementations to be added here
type MongoDb ¶ added in v0.2.1
MongoDb struct
func GetMongoDb ¶ added in v0.2.1
GetMongoDb client connection to the database
func (*MongoDb) FindAdsWithObjects ¶ added in v0.2.1
func (mongoDb *MongoDb) FindAdsWithObjects(ctx context.Context, objects []string) ([]Advertisement, error)
FindAdsWithObjects find all ads that have objects in the given object list
func (*MongoDb) GetAllVideos ¶ added in v0.2.1
GetAllVideos from the collection
func (*MongoDb) GetVideoInference ¶ added in v0.2.1
GetVideoInference from the collection
func (*MongoDb) InitializeVideoInference ¶ added in v0.2.1
InitializeVideoInference with processing if it does not exist or the status is failed and return true to process else return false (either in processing or complete)
func (*MongoDb) InsertAd ¶ added in v0.2.1
func (mongoDb *MongoDb) InsertAd(ctx context.Context, ad Advertisement) error
InsertAd into the collection
func (*MongoDb) InsertVideo ¶ added in v0.2.1
InsertVideo into the collection
func (*MongoDb) InsertVideoInference ¶ added in v0.2.1
func (mongoDb *MongoDb) InsertVideoInference(ctx context.Context, videoInference VideoInference) error
InsertVideoInference into the collection
func (*MongoDb) UpdateVideoInference ¶ added in v0.2.1
func (mongoDb *MongoDb) UpdateVideoInference(ctx context.Context, videoInference VideoInference) error
UpdateVideoInference into the collection
type Video ¶
type Video struct {
Id string `bson:"_id,omitempty"`
Name string
Description string
StorageLink string
}
Video Struct TODO find some alternative to annotation to make this generic
type VideoInference ¶
type VideoInference struct {
Id string `bson:"_id,omitempty"` // Video Identifier
Status string // Video Inference processing status -> PROCESSING, COMPLETE, FAILED
ObjectCountsEachSecond string
ObjectsToAvgFrequency map[string]float32
TopFiveObjectsToInterval map[string]Interval
TopFiveObjectsToAvgFrequency map[string]float32
}
VideoInference Struct TODO find some alternative to annotation to make this generic