Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

core.DataSource plugin #60

Closed
skipor opened this issue Jul 24, 2017 · 1 comment · Fixed by #90
Closed

core.DataSource plugin #60

skipor opened this issue Jul 24, 2017 · 1 comment · Fixed by #90

Comments

@skipor
Copy link
Contributor

skipor commented Jul 24, 2017

We want go use different data sources for Providers, but not create multiple providers with same decoding logic.
Proposed, to create core.DataSource plugin, that will contain logic of getting encoded ammo bytes, and use it as nested plugin in Providers that takes bytes from somewhere and decodes them.

Here some draft:

type DataSource {
    // Open opens data source. 
    // Returned source can be file, socket, string or byte reader, or anything else, that implements
    // more that io.Reader, so it's ok to check if source is io.Seeker, and seek if it is.
    // Specific type checking (*os.File, for example) highly not recommended - use interfaces.
    Open() (source io.Closer, err error)
}

What DataSources can be implemented:

  • file (filepath to open)
  • socket (some string, that can be passed to net.Listen)
  • url (http/https URL to download)
  • inline (string inlined to config)
@skipor
Copy link
Contributor Author

skipor commented Jul 29, 2017

Let's also add DataSinkcore plugin, that will contains logic of encoding and saving stream of bytes from Aggregators

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant