service

package
v1.7.0 Latest Latest
Warning

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

Go to latest
Published: Jun 9, 2020 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DatasetClient

type DatasetClient interface {
	GetInstance(ctx context.Context, userAuthToken, serviceAuthToken, collectionID, instanceID string) (m dataset.Instance, err error)
	PostInstanceDimensions(ctx context.Context, serviceAuthToken, instanceID string, data dataset.OptionPost) error
	PutInstanceData(ctx context.Context, serviceAuthToken, instanceID string, data dataset.JobInstance) error
}

DatasetClient is an interface to represent methods called to action upon Dataset REST interface

type DimensionExtracted

type DimensionExtracted struct {
	FileURL    string `avro:"file_url"`
	InstanceID string `avro:"instance_id"`
}

DimensionExtracted represents a kafka avro model for a dimension extracted file for an instance

type InputFileAvailable

type InputFileAvailable struct {
	FileURL    string `avro:"file_url"`
	InstanceID string `avro:"instance_id"`
}

InputFileAvailable represents a kafka avro model for an available input file fo an instance

func (*InputFileAvailable) S3URL

func (inputFileAvailable *InputFileAvailable) S3URL() (*s3client.S3Url, error)

S3URL parses the fileURL into an S3Url struct. s3:// prefix is interpreted as DNS-Alias-virtual-hosted style. Otherwise, path-style is assumed.

type KafkaProducer

type KafkaProducer interface {
	Channels() *kafka.ProducerChannels
	Close(ctx context.Context) (err error)
}

KafkaProducer is an interface to represent methods called to action upon Kafka to produce messages

type S3Client

type S3Client interface {
	Get(key string) (io.ReadCloser, error)
	GetWithPSK(key string, psk []byte) (io.ReadCloser, error)
	Checker(ctx context.Context, state *healthcheck.CheckState) error
}

S3Client is an interface to represent methods called to action upon AWS S3

type Service

type Service struct {
	AuthToken                  string
	DimensionExtractedProducer KafkaProducer
	EncryptionDisabled         bool
	DatasetClient              DatasetClient
	AwsSession                 *session.Session
	S3Clients                  map[string]S3Client
	VaultClient                VaultClient
	VaultPath                  string
}

Service handles incoming messages.

func (*Service) HandleMessage

func (svc *Service) HandleMessage(ctx context.Context, message kafka.Message) (string, error)

HandleMessage handles a message by sending requests to the dataset API before producing a new message to confirm successful completion

type VaultClient

type VaultClient interface {
	ReadKey(path, key string) (string, error)
}

VaultClient is an interface to represent methods called to action upon Vault

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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