Documentation ¶
Overview ¶
Package control holds the implementation of the Slack Stream controller. It runs the API scraping in several goroutines and manages the data flow between them. It records the output of the API scraper into a chunk directory. It also manages the transformation of the data, if the caller is interested in it.
Index ¶
- type Controller
- func (c *Controller) Run(ctx context.Context, list *structures.EntityList) error
- func (s *Controller) SearchAll(ctx context.Context, query string) error
- func (s *Controller) SearchFiles(ctx context.Context, query string) error
- func (s *Controller) SearchMessages(ctx context.Context, query string) error
- type Error
- type ExportTransformer
- type Flags
- type Option
- type Streamer
- type TransformStarter
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Controller ¶
type Controller struct {
// contains filtered or unexported fields
}
Controller is the main controller of the Slack Stream. It runs the API scraping in several goroutines and manages the data flow between them.
func New ¶
func New(cd *chunk.Directory, s Streamer, opts ...Option) *Controller
New creates a new Controller.
func (*Controller) Run ¶
func (c *Controller) Run(ctx context.Context, list *structures.EntityList) error
func (*Controller) SearchAll ¶
func (s *Controller) SearchAll(ctx context.Context, query string) error
func (*Controller) SearchFiles ¶
func (s *Controller) SearchFiles(ctx context.Context, query string) error
func (*Controller) SearchMessages ¶
func (s *Controller) SearchMessages(ctx context.Context, query string) error
type Error ¶
type Error struct { // Subroutine is the name of the subroutine that failed. Subroutine string // Stage is the stage of the subroutine that failed. Stage string // Err is the error that caused the failure. Err error }
Error is a controller error.
type ExportTransformer ¶
type ExportTransformer interface { dirproc.Transformer TransformStarter }
ExportTransformer is a transformer that can be started with a list of users. The compound nature of this interface is called by the asynchronous nature of execution and the fact that we need to start the transformer after Users goroutine is done, which can happen any time after the Run has started.
type Option ¶
type Option func(*Controller)
Option is a functional option for the Controller.
func WithLogger ¶
WithLogger configures the controller with a logger.
func WithTransformer ¶
func WithTransformer(tf ExportTransformer) Option
WithTransformer configures the controller with a transformer.
type Streamer ¶
type Streamer interface { Conversations(ctx context.Context, proc processor.Conversations, links <-chan string) error ListChannels(ctx context.Context, proc processor.Channels, p *slack.GetConversationsParameters) error Users(ctx context.Context, proc processor.Users, opt ...slack.GetUsersOption) error WorkspaceInfo(ctx context.Context, proc processor.WorkspaceInfo) error SearchMessages(ctx context.Context, proc processor.MessageSearcher, query string) error SearchFiles(ctx context.Context, proc processor.FileSearcher, query string) error }
Streamer is the interface for the API scraper.