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
devcam: server --makethings #417
Comments
it's high time we started with that, so we can test the importers output in the UI with less pain... https://camlistore-review.googlesource.com/3151 |
for the optional interface, you proposed: type TestDataMaker interface { MakeTestData(bs blobserver.Storage) error } I don't think I understand where you want to go with the signature of MakeTestData, so I'd rather discuss it before going further. If MakeTestData eventually calls Run(rc *importer.RunContext), it will need to create (or be given) a RunContext, because that's what the signature of Run wants, and that's what the run uses to get everything it needs from the importer pkg. Like when it calls r.Host.BlobSource(), or r.RootNode(). So, among other things, we need to have a *Host for our RunContext. However, iiuc, we're not supposed to create a *Host for each importer impl, there's one for all of them. So we should rather pass a *Host to MakeTestData, which will use it to create a RunContext, no? Like so: func (im *imp) MakeTestData(h *import.Host) error { rc := importer.NewRunContext(h) // to be created in importer.go // setup responses // ... tr := test.NewFakeTransport(responses) rc.Context = context.New(context.WithHTTPClient(&http.Client{Transport: tr})) return im.Run(rc) } or we could even directly pass a RunContext to MakeTestData, like so: func (im *imp) MakeTestData(rc *importer.RunContext) error If yes, comes the question of where we get the *Host (that devcam will pass to MakeTestData). Do we create a new one, from a bunch of parameters (like a bs blobserver.Storage), or do we reuse the one already created by camlistored at the importer's init (newFromConfig) ? |
ok, that plan looks like it's working. rough draft in patchset 3 of https://camlistore-review.googlesource.com/3151 |
Since the *Host is at the core of the importer pkg, it looks like making a "remote" *Host requires making some substantial changes, like using a *client.Client for its target (blobserver.StatReceiver), as well as for its blobSource (blob.Fetcher), and signer (*schema.Signer). Worse, it has a search Handler, which I think is used during the Run, so this one would have to be swapped for a client that does search queries too. This is starting to look like the publisher as a server app migration work. I've started but it does not look like going the right way so far... At this point, I think it'd be less disruptive to simply add an (undocumented/hidden/debug) http access point (like the "populate" I had done in https://camlistore-review.googlesource.com/#/c/3151/2/pkg/importer/importer.go) that would trigger the makeThings(). And devcam server would just do an http request on it once camlistored is up. Or maybe a debug --makethings flag to camlistored ? Or maybe there's a way to break Host into more reusable pieces... Just letting you know early since you don't want this to become a big thing. |
This issue was closed.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
The text was updated successfully, but these errors were encountered: