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

Fallback path for mmap #163

Open
database64128 opened this issue Jan 13, 2025 · 1 comment · May be fixed by #166
Open

Fallback path for mmap #163

database64128 opened this issue Jan 13, 2025 · 1 comment · May be fixed by #166

Comments

@database64128
Copy link
Contributor

If the db is on a file system without mmap support, like a remote share or some FUSE filesystem, mmap(2)/MapViewOfFile may fail. Now that we target Go 1.23+, there's an easy way to detect this with errors.Is(err, errors.ErrUnsupported) (added in Go 1.21). This seems to work quite well in my project: https://github.com/database64128/shadowsocks-go/blob/f299d1bb61ba85840dbfbf948adeb8d2b4c216c4/mmap/mmap.go#L39

If you are OK with this idea, I can open a PR to implement it.

@oschwald
Copy link
Owner

Sure, I'd be happy to accept a PR to do that. Please mention it in the documentation for the function as well.

database64128 added a commit to database64128/maxminddb-golang that referenced this issue Jan 20, 2025
database64128 added a commit to database64128/maxminddb-golang that referenced this issue Jan 21, 2025
@database64128 database64128 linked a pull request Jan 21, 2025 that will close this issue
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 a pull request may close this issue.

2 participants