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

FS Context #137

Merged
merged 19 commits into from
Nov 25, 2024
Merged

FS Context #137

merged 19 commits into from
Nov 25, 2024

Conversation

james-pre
Copy link
Member

This PR tracks implementation of contexts, which will be used to isolate FS trees (much like chroot)

It will resolve #124.

@james-pre james-pre added the enhancement New feature or request label Nov 16, 2024
@james-pre james-pre self-assigned this Nov 16, 2024
@james-pre james-pre marked this pull request as draft November 18, 2024 07:21
@james-pre james-pre marked this pull request as ready for review November 24, 2024 21:21
@james-pre
Copy link
Member Author

james-pre commented Nov 25, 2024

@konsumer @mcandeia,

Do you have any feedback on this feature before I merge it? For reference, you can use it like so:

import { bindContext, fs } from '@zenfs/core';
import assert from 'assert';

const one = bindContext('/root_1');

one.writeFileSync('/example.txt', 'Not in the real root.');
fs.readFileSync('/root_1/example.txt', 'utf8'); // file contents

assert.deepEqual(one.readdirSync('/../../../..'), fs.readdirSync('/root_1'));

const two = bindContext('/root_2', { uid: 100, gid: 100 });

Feel free to review the code.

@james-pre
Copy link
Member Author

I've merged this PR after some feedback from Marcos. If David has any feedback, I'll handle it on the main branch.

@james-pre james-pre merged commit 6331231 into main Nov 25, 2024
1 check passed
@james-pre james-pre deleted the context branch November 25, 2024 01:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Isolated FS trees, chroot
1 participant