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
added interface for collector #5
Conversation
9b3c141
to
946f3bf
Compare
e6185c9
to
dd164e3
Compare
@lumjjb Ready for re-review. |
want *Backend | ||
wantErr bool | ||
}{ | ||
// TODO: Add test cases. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
let's add some here :)
Signed-off-by: pxp928 <parth.psu@gmail.com>
cdc3fc5
to
b0e4ec1
Compare
Signed-off-by: pxp928 <parth.psu@gmail.com>
Signed-off-by: pxp928 <parth.psu@gmail.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(looked at it thinking it was the PR we paired on today, got a few questions only)
type Config struct { | ||
Collector CollectorConfigs | ||
} | ||
|
||
// CollectorConfigs contains the configuration to instantiate different collector providers | ||
type CollectorConfigs struct { | ||
GCS GCSSCollectorConfig | ||
OCI OCICollectorConfig | ||
Transparency TransparencyConfig | ||
PubSub PubSubCollectorConfig | ||
} | ||
|
||
type GCSSCollectorConfig struct { | ||
Bucket string | ||
} | ||
|
||
type OCICollectorConfig struct { | ||
Repository string | ||
Insecure bool | ||
} | ||
|
||
type PubSubCollectorConfig struct { | ||
Provider string | ||
Topic string | ||
} | ||
|
||
type TransparencyConfig struct { | ||
Enabled bool | ||
VerifyAnnotation bool | ||
URL string | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm thinking that we can do a modular registration approach like in
guac/pkg/ingestor/processor/process/process.go
Lines 26 to 39 in 3ef1b5a
var ( | |
documentProcessors = map[processor.DocumentType]processor.DocumentProcessor{} | |
) | |
func init() { | |
// Registerprocessor.DocumentProcessor() | |
} | |
func RegisterDocumentProcessor(p processor.DocumentProcessor, d processor.DocumentType) { | |
if _, ok := documentProcessors[d]; ok { | |
logrus.Warnf("the document processor is being overwritten: %s", d) | |
} | |
documentProcessors[d] = p | |
} |
init
initialize whatever additional static fields are needed, call the Register...
function and later at runtime select the corresponding collector from the map.
We can also go with this for now and refactor later, though it might be more work.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes this was the piece I was asking about. Need to rethink the initializing piece. I will do it the other way as it makes more sense.
GCS GCSSCollectorConfig | ||
OCI OCICollectorConfig | ||
Transparency TransparencyConfig | ||
PubSub PubSubCollectorConfig |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is like a sum type, right? That is, only one of these configs should be set at any given time during runtime?
Closing PR for redesign. |
Add CertifyVEXStatement and IngestVEXStatement
Signed-off-by: pxp928 parth.psu@gmail.com
Added interface for collector. Utilizing a configuration to specify the bucket address and such. Currently implementing the google cloud bucket interface.