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

Support reading/writing chunks in remote fs #41985

Open
bpasero opened this issue Jan 22, 2018 · 4 comments
Open

Support reading/writing chunks in remote fs #41985

bpasero opened this issue Jan 22, 2018 · 4 comments
Assignees
Labels
api api-proposal feature-request Request for new features or functionality remote Remote system operations issues
Milestone

Comments

@bpasero
Copy link
Member

bpasero commented Jan 22, 2018

This is a follow up from #32503 where IFileService.updateContent() now accepts a ITextSnapshot to prevent loading the entire buffer into memory. I left a TODO here to use ITextSnapshot directly and not the current fallback snapshotToString

@bpasero bpasero added the remote Remote system operations issues label Jan 22, 2018
@jrieken
Copy link
Member

jrieken commented Jan 23, 2018

Yeah, goes along with these todos in the write function (see update below)

		// todo@joh - have an option to create iff not exist
		// todo@remote
		// offset - byte offset to start
		// count - number of bytes to write
		// Thenable<number> - number of bytes actually written
		write(resource: Uri, content: Uint8Array): Thenable<void>;

@jrieken jrieken changed the title Remote: handle ITextSnapshot when writing Support writing chunks in remote fs Mar 29, 2018
@jrieken jrieken added the debt Code quality issues label Mar 29, 2018
@jrieken jrieken added this to the April 2018 milestone Mar 29, 2018
jrieken added a commit that referenced this issue Apr 11, 2018
@jrieken jrieken changed the title Support writing chunks in remote fs Support reading/writing chunks in remote fs Apr 11, 2018
@jrieken
Copy link
Member

jrieken commented Apr 11, 2018

Plan is to have more explicit, posix-style, calls that open/close a file and that read arbitrary content of a file. Something like this:

open(uri: Uri, opts): number | Thenable<number>;
close(fd: number): void | Thenable<void>;
read(fd: number, pos: number, into: Uint8Array): number | Thenable<number>;
write(fd: number, pos: number, data: Uint8Array): number | Thenable<number>;

This will compliment the simple readFile and writeFile methods and are optional (tho recommended) and it also means the implementing side needs to keep some state around.

@jrieken
Copy link
Member

jrieken commented Mar 26, 2019

Currently there is no way for a file based implementation to know if the open() call is to read a file or writing to it. I think it would be best to add related options to it. In node.js jargon this is called flags.
Currently I just use w if create: true and r otherwise.
I guess this has an impact on (proposed) API too.

@eliphatfs
Copy link

Is this going to be implemented anytime soon? It has been five years and it is still unsupported.
I added a hardcoded 5MB limit in my remote fs to avoid miss-clicking on large files occupying the connection now, but I hope there would be a better solution.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api api-proposal feature-request Request for new features or functionality remote Remote system operations issues
Projects
None yet
Development

No branches or pull requests

3 participants