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

keep brim folders inside app data #714

Merged
merged 3 commits into from
May 4, 2020
Merged

Conversation

mason-fish
Copy link
Contributor

fixes #673

Our spaces are still named .brim but the internal folder we use is now stored within the app's data. I tested this in dev and also release.

movebrimfolder

@mason-fish mason-fish requested review from jameskerr and a team April 29, 2020 20:17
@@ -51,16 +51,23 @@ const validateInput = (paths) => ({

const createDir = () => ({
async do({dataDir}) {
await fsExtra.ensureDir(dataDir)
dataDir && (await fsExtra.ensureDir(dataDir))
Copy link
Member

Choose a reason for hiding this comment

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

It seems like this whole step will be removed once #676 is done. All we might do is check that the user specified directory exists.

Copy link
Member

Choose a reason for hiding this comment

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

Wait, I might understand the data_dir thing correctly. This might be fine.

if (params.dataDir) {
createParams = {data_dir: params.dataDir}
} else {
createParams = {name: params.name}
Copy link
Member

Choose a reason for hiding this comment

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

Is there a reason why we don't send the name in all cases?

Copy link
Contributor Author

@mason-fish mason-fish Apr 30, 2020

Choose a reason for hiding this comment

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

I opted to send one or the other bc zqd only handles for one (https://github.com/brimsec/zq/blob/master/zqd/space/space.go#L108-L123) (giving preference to name by handling it first if it is present) and I thought it might confuse anyone looking at this code to see that it sends both but only uses name.

@jameskerr
Copy link
Member

jameskerr commented Apr 30, 2020

After testing this, I see some limitations here.

After opening one pcap...

  • When I try to load the pcap for the second time, I get the message from zqd saying "Space exists", and get put back on the New Tab Page.
  • When I try to load a different pcap (in a different dir) with the same name, I get the same error "Space exists".

image

In the first situation it seems we ought open that space for them. The second situation seems like a new bug.

I think we'd need to do this ZQD issue first brimdata/super#686 (generate space ids), before we'll be able to merge this PR without introducing bugs.

Does that sound right?

@mason-fish
Copy link
Contributor Author

@jameskerr I'm inclined to agree. If we make the space id change first in the backend then I'm p sure this will work as is, which includes continuing to be able to make duplicate spaces if a user wants (though it may be better to not allow that and instead detect the duplicate on the FE and take the user direct to the existing space, as you suggest)

Mason Fish added 2 commits May 1, 2020 17:41
Signed-off-by: Mason Fish <mason@looky.cloud>
Signed-off-by: Mason Fish <mason@looky.cloud>
@mason-fish mason-fish force-pushed the 673-use_default_brim_location branch from b0e5bf4 to 1218ac9 Compare May 2, 2020 00:47
Signed-off-by: Mason Fish <mason@looky.cloud>
@@ -56,6 +56,7 @@ function getCurrentSpaceName(spaces, desired) {
function setSpace(dispatch, data, clusterId) {
globalDispatch(Spaces.setDetail(clusterId, data))
dispatch(Search.setSpace(data.name))
data = brim.interop.spacePayloadToSpace(data)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@jameskerr The problem is that the span parsing we are doing rn is late in the stack, in the reducer (https://github.com/brimsec/brim/pull/715/files#diff-31bf947bfb654ba8ccfd57214bfb417dR21), and yet the original span which has not been put through that adapter/parser continues to get passed along by this function to the rest of the initSpace chain. So I've adjusted this to do the same operation on a different copy and return that. Not a great pattern, would be better if we can handle this mutation inside the client, or at least much earlier before it gets passed around in different formats.

@mason-fish mason-fish requested a review from jameskerr May 2, 2020 03:22
Copy link
Member

@jameskerr jameskerr left a comment

Choose a reason for hiding this comment

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

Looks good. Thanks

@mason-fish mason-fish merged commit 4be49d4 into master May 4, 2020
@mason-fish mason-fish deleted the 673-use_default_brim_location branch May 4, 2020 16:55
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.

Stop creating the .brim folder
2 participants