quotes

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Jan 15, 2020 License: Apache-2.0 Imports: 24 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MapQuoteWords           = "MapQuoteWords"
	DimQuoteAuthor          = "DimQuoteAuthor"
	DimQuoteCount           = "DimQuoteCount"
	DimQuoteID              = "DimQuoteID"
	DimQuoteTime            = "DimQuoteTime"
	DimQuoteWord            = "DimQuoteWord"
	DimQuoteWordCount       = "DimQuoteWordCount"
	DimQuoteWordTotalCount  = "DimQuoteWordTotalCount"
	MetricLastQuoteID       = "MetricLastQuoteID"
	MetricSumQuoteCount     = "MetricSumQuoteCount"
	MetricSumWordQuoteCount = "MetricSumWordQuoteCount"
	MetricSumWordTotalCount = "MetricSumWordTotalCount"
	MetricUniqueWords       = "MetricUniqueWords"
	RelQuoteWords           = "RelQuoteWords"
	MVWordStats             = "MVWordStats"
	MVQuoteStats            = "MVQuoteStats"
	MVRecentQuotes          = "MVRecentQuotes"

	MapQuoteWordsTag          factable.MapTag = iota
	DimQuoteAuthorTag         factable.DimTag = iota
	DimQuoteCountTag          factable.DimTag = iota
	DimQuoteIDTag             factable.DimTag = iota
	DimQuoteTimeTag           factable.DimTag = iota
	DimQuoteWordCountTag      factable.DimTag = iota
	DimQuoteWordTag           factable.DimTag = iota
	DimQuoteWordTotalCountTag factable.DimTag = iota
	MVWordStatsTag            factable.MVTag  = iota
	MVQuoteStatsTag           factable.MVTag  = iota
	MVRecentQuotesTag         factable.MVTag  = iota
)
View Source
const (
	InputJournal  pb.Journal = "examples/factable/quotes/input"
	SchemaSpecKey            = "/path/to/schema/key"
)

Variables

This section is empty.

Functions

func BuildExtractors

func BuildExtractors() factable.ExtractFns

func BuildSchemaSpec

func BuildSchemaSpec() factable.SchemaSpec

func Mapping

func Mapping(_ message.Mappable) (journal pb.Journal, contentType string, e error)

Mapping is a message.MappingFunc which maps all Quotes to InputJournal.

func PublishQuotes

func PublishQuotes(begin, end int, relPath string, ajc client.AsyncJournalClient) (err error)

PublishQuotes publishes quotes [begin, end) of the corpus. |relPath| is the relative path of the package invoking PublishQuotes with respect to the repository `pkg` directory.

func StartApplication

func StartApplication(tc TestCase, app runconsumer.Application) *consumertest.Consumer

StartApplication configures and initializes a Extractor or VTable Application.

Types

type Quote

type Quote struct {
	ID     int64     // Unique ID of the Quote.
	Author string    // Language of the Quote.
	Text   string    // Text of the Document.
	Time   time.Time // Timestamp of the Quote.
}

func (Quote) GetUUID

func (q Quote) GetUUID() uuid.UUID

Keep it simple. Do not opt into exactly-once semantics. Do this at a later time.

func (Quote) NewAcknowledgement

func (q Quote) NewAcknowledgement(journal broker.Journal) message.Message

TODO is this correct? (If it is, why have such a trivial method in the first place?)

func (Quote) SetUUID

func (q Quote) SetUUID(uuid uuid.UUID)

type Specs

type Specs struct {
	Journals        []*broker.JournalSpec
	ExtractorShards []*consumer.ShardSpec
	VTableShards    []*consumer.ShardSpec
}

Specs bundles JournalSpecs and ShardSpecs for extractor and vtable consumers operating against the `quotes` package.

func BuildSpecs

func BuildSpecs(parts int, views ...factable.MVTag) Specs

BuildSpecs returns Specs having |parts| delta partitions.

type TestCase

type TestCase struct {
	C        *gc.C
	Ctx      context.Context
	Etcd     *clientv3.Client
	Broker   *brokertest.Broker
	Journals pb.RoutedJournalClient

	Specs
	SchemaPath string
}

TestCase packages boilerplate runtime state used in the writing of tests leveraging the "quotes" package.

func NewTestCase

func NewTestCase(c *gc.C, specs Specs) (TestCase, func())

NewTestCase stands up runtime state for a test using the given configured Specs. It returns a cleanup closure which should be invoked on test completion.

Jump to

Keyboard shortcuts

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