Skip to content

feat: add support for FUSE - #135

Merged
enocom merged 12 commits into
mainfrom
fuse
Sep 19, 2022
Merged

enocom merged 12 commits into
mainfrom
fuse

Conversation

@enocom

@enocom enocom commented Sep 15, 2022

Copy link
Copy Markdown
Member

@enocom
enocom requested a review from a team September 15, 2022 16:58
Comment thread internal/proxy/fuse.go
}

const readmeText = `
When applications attempt to open files in this directory, a remote connection

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

I updated the README for AlloyDB.

Comment thread internal/proxy/proxy.go Outdated
return c.NewInode(ctx, &readme{}, fs.StableAttr{}), fs.OK
}

instanceURI, err := toFullURI(instance)

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

This check expands the requested instance (e.g., proj.region.cluster.inst) into a full instance URI. If instance isn't a valid short Unix name, it returns an error.

@hessjcg hessjcg left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Please double-check the concurrency in the Client.Close() method.

Comment thread internal/proxy/proxy.go Outdated
Comment thread internal/proxy/proxy.go

@hessjcg hessjcg left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Good to go. A few nits remain.

Comment thread internal/proxy/proxy.go
@@ -151,10 +160,13 @@ var (
// 'projects/<PROJECT>/locations/<REGION>/clusters/<CLUSTER>/instances/<INSTANCE>'
// Additionally, we have to support legacy "domain-scoped" projects (e.g. "google.com:PROJECT")
instURIRegex = regexp.MustCompile("projects/([^:]+(:[^:]+)?)/locations/([^:]+)/clusters/([^:]+)/instances/([^:]+)")

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Optional Nit: If you wanted to be really clever, use a non-capturing group (?: ) for the sub-domain in PROJECT group

instURIRegex = regexp.MustCompile(
    "projects/([^:]+(?::[^:]+)?)/locations/([^:]+)/clusters/([^:]+)/instances/([^:]+)")

Then the so that your code down below goes 1,2,3,4:

project := string(m[1])
region := string(m[2])
cluster := string(m[3])
name := string(m[4])

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Fancy -- I'm working on making this code exported from the connector and will revisit this change with unit tests when I get there.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

See #137.

Comment thread internal/proxy/other_test.go

@hessjcg hessjcg left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Looks good. Nice cleanup.

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.

Add support for FUSE mounts

2 participants