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

Add base data stream into package #681

Closed
wants to merge 1 commit into from
Closed

Add base data stream into package #681

wants to merge 1 commit into from

Conversation

kaiyan-sheng
Copy link
Contributor

@kaiyan-sheng kaiyan-sheng commented Feb 2, 2021

(just a draft PR for my small poc)
This PR is to adjust the code to read the new config option expand_data_stream at the package level. When expand_data_stream is set to true, abstract data stream info and store them into the /search API endpoint result.

For example with expand_data_stream: true in AWS package, /search API response will look like this:

[
  {
    "name": "aws",
    "title": "AWS",
    "version": "0.3.18",
    "release": "beta",
    "description": "AWS Integration",
    "type": "integration",
    "download": "/epr/aws/aws-0.3.18.zip",
    "path": "/package/aws/0.3.18",
    "icons": [
      {
        "src": "/img/logo_aws.svg",
        "path": "/package/aws/0.3.18/img/logo_aws.svg",
        "title": "logo aws",
        "size": "32x32",
        "type": "image/svg+xml"
      }
    ],
    "base_data_streams": [
      ...
      {
        "type": "metrics",
        "dataset": "aws.ec2_metrics",
        "title": "AWS EC2 metrics",
        "release": "beta",
        "description": "AWS EC2 Integration",
        "icons": [
          {
            "src": "../img/logo_aws_ec2.svg",
            "path": "",
            "title": "logo aws ec2",
            "size": "32x32",
            "type": "image/svg+xml"
          }
        ]
      },
      ...
    ]
  }
]

Copy link
Contributor

@mtojek mtojek left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TL;DR Remember, the spec goes first :)

There are few steps to push this change:

  1. Package-spec.
  2. API design of package-registry.
  3. Implementation of package-registry.

Re 1:
I think we all agree with expand_data_streams. Do you want to introduce images/screenshots on the data stream level? You can open a PR to package-spec and we can discuss it there.

Re 2:
I would consider two approaches:

  1. Introduce data streams previews (BaseDataStream) which contain as min information as possible comparing to the owning package.

Re 3:
Once we agree on 1. and 2., this is a good moment to go with implementation of the package-registry.

@@ -55,6 +58,17 @@ type DataStream struct {
BasePath string `json:"-" yaml:"-"`
}

type BaseDataStream struct {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was wondering why is it a "base" data stream. I got the idea, but can't relate this name with meaning.

@@ -97,19 +111,19 @@ type fieldEntry struct {
aType string
}

func NewDataStream(basePath string, p *Package) (*DataStream, error) {
func NewDataStream(basePath string, p *Package) (*DataStream, *BaseDataStream, error) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The util package contains structs and methods which can be used in other repositories. I woudn't change signatures of exported methods.

@@ -42,6 +42,9 @@ type DataStream struct {
Title string `config:"title" json:"title" validate:"required"`
Release string `config:"release" json:"release"`

Description string `config:"description" json:"description"`
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In general BasePackage and DataStream correspond to their format in package-spec. I wouldn't extend them this way. If you need to add more fields to view, but not manifest, I would consider creating new structures (possibly extending ones in spec).

Comment on lines +63 to +64
Type string `config:"type" json:"type" validate:"required"`
Dataset string `config:"dataset" json:"dataset,omitempty" yaml:"dataset,omitempty"`
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like redundant information?

Path string `json:"path" yaml:"path,omitempty"`
Icons []Image `config:"icons,omitempty" json:"icons,omitempty" yaml:"icons,omitempty"`
Internal bool `config:"internal,omitempty" json:"internal,omitempty" yaml:"internal,omitempty"`
BaseDataStreams []*BaseDataStream `config:"base_data_streams,omitempty" json:"base_data_streams,omitempty" yaml:"base_data_streams,omitempty"`
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

BaseDataStream contains redundant data that you can find in package. I think we should keep them only in package to prevent the response body from increasing.

BTW base data streams look to me more like data stream previews or sth (just looking for a different name :)

Copy link
Member

@ruflin ruflin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lets put this on hold until we completed the discussion on package-spec.

@kaiyan-sheng kaiyan-sheng deleted the expand_data_stream branch March 23, 2021 12:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants