Documentation ¶
Index ¶
- Constants
- func GetAvroCodec(schema string) (*goavro.Codec, error)
- func GetDatastoreShardId(key string, numShards int) uint64
- type AvroFileWriter
- type AvroFileWriterConfig
- type AvroSerializer
- type Config
- type Datastore
- type Datastores
- type InMemDataStore
- func (ds *InMemDataStore) Get(key string) (interface{}, error)
- func (ds *InMemDataStore) GetAll() map[string]interface{}
- func (ds *InMemDataStore) GetDatastores() Datastores
- func (ds *InMemDataStore) Put(key string, val map[string]interface{}) error
- func (ds *InMemDataStore) Shutdown()
- func (ds *InMemDataStore) Start()
- type NoopSerializer
- type PersistenceChan
- type Persister
- type PersisterConfig
- type Persisters
- type Serializer
- type Writer
Constants ¶
View Source
const (
RecFieldId = "id"
)
Variables ¶
This section is empty.
Functions ¶
func GetAvroCodec ¶ added in v0.2.0
func GetDatastoreShardId ¶ added in v0.2.0
Types ¶
type AvroFileWriter ¶ added in v0.2.0
type AvroFileWriter struct {
// contains filtered or unexported fields
}
func NewAvroFileWriter ¶ added in v0.2.0
func NewAvroFileWriter(ctx context.Context, wg *sync.WaitGroup, cfg AvroFileWriterConfig) *AvroFileWriter
func (*AvroFileWriter) Shutdown ¶ added in v0.2.0
func (a *AvroFileWriter) Shutdown()
func (*AvroFileWriter) Write ¶ added in v0.2.0
func (a *AvroFileWriter) Write(data interface{}) error
type AvroFileWriterConfig ¶ added in v0.2.0
type AvroSerializer ¶ added in v0.2.0
type AvroSerializer struct {
// contains filtered or unexported fields
}
func (*AvroSerializer) Serialize ¶ added in v0.2.0
func (a *AvroSerializer) Serialize(record map[string]interface{}) (interface{}, error)
type Config ¶
type Config struct { NumDatastoreShards int PersistenceChan PersistenceChan PersistanceChanBuffSize int Persisters Persisters // The top-level key in the map[string]interface{} records that will be stored in the // InMemoryDataStore. This is required for the Put method to process a new record. RecordTimestampKey string }
type Datastore ¶ added in v0.2.0
type Datastore struct { Id uint64 Data map[string]interface{} NumReads int64 NumWrites int64 // contains filtered or unexported fields }
func NewDatastore ¶ added in v0.2.0
type Datastores ¶ added in v0.2.0
type InMemDataStore ¶
type InMemDataStore struct {
// contains filtered or unexported fields
}
func NewInMemDatastore ¶
func NewInMemDatastore(ctx context.Context, cancel context.CancelFunc, wg *sync.WaitGroup, cfg Config) *InMemDataStore
func (*InMemDataStore) Get ¶
func (ds *InMemDataStore) Get(key string) (interface{}, error)
func (*InMemDataStore) GetAll ¶
func (ds *InMemDataStore) GetAll() map[string]interface{}
GetAll will return the entire in memory data store. For a production grade piece of software we would have to do something other than just returning a reference to the private map, such as a deep copy. For now, this is just here to facilitate testing.
func (*InMemDataStore) GetDatastores ¶ added in v0.2.0
func (ds *InMemDataStore) GetDatastores() Datastores
func (*InMemDataStore) Put ¶
func (ds *InMemDataStore) Put(key string, val map[string]interface{}) error
func (*InMemDataStore) Shutdown ¶
func (ds *InMemDataStore) Shutdown()
Shutdown will signal the Serializers to close their open file handles and shutdown the IMDS.
func (*InMemDataStore) Start ¶
func (ds *InMemDataStore) Start()
Start will spin up the Persisters and when it returns will be ready for reads and writes.
type NoopSerializer ¶ added in v0.2.0
type NoopSerializer struct{}
func (*NoopSerializer) Serialize ¶ added in v0.2.0
func (n *NoopSerializer) Serialize(record map[string]interface{}) (interface{}, error)
type PersistenceChan ¶ added in v0.2.0
type PersistenceChan chan map[string]interface{}
type Persister ¶ added in v0.2.0
type Persister struct { Serializer Writer // contains filtered or unexported fields }
func NewPersister ¶ added in v0.2.0
type PersisterConfig ¶ added in v0.2.0
type PersisterConfig struct { Id int Serializer Serializer Writer Writer InputChan PersistenceChan }
type Persisters ¶ added in v0.2.0
type Serializer ¶
func NewAvroSerializer ¶ added in v0.2.0
func NewAvroSerializer(avroSchema string) Serializer
func NewNoopSerializer ¶ added in v0.2.0
func NewNoopSerializer() Serializer
Click to show internal directories.
Click to hide internal directories.