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

static_filename - directories, lifetime #58

Open
encukou opened this issue Dec 27, 2018 · 3 comments
Open

static_filename - directories, lifetime #58

encukou opened this issue Dec 27, 2018 · 3 comments

Comments

@encukou
Copy link
Member

encukou commented Dec 27, 2018

Two questions about static_filename that aren't clear from the docs:

  • Is it supposed to work on directories?
  • For how long can I use the result reliably? (When can the file be garbage-collected or overwritten?)
@encukou encukou changed the title Lifetime of static_filename static_filename - directories, lifetime Dec 27, 2018
@mikicz
Copy link
Member

mikicz commented Jan 19, 2019

  • I wasn't originally intending it to work on directories, but from a simple look, it seems it might work? It just concats the location where it was cloned and the provided relative path and checking that it's still inside the repo, so could work.
  • Hm... Now that's interesting. Do you mean like how long before Arca deletes the file? That would be until a pull is performed and the file is deleted in the new commits, but obviously the file can change underneath... So when single pull is disabled, in theory on each static_filename call there could be a new file there if there are new commits every time...

@encukou
Copy link
Member Author

encukou commented Jan 21, 2019

  • I wasn't originally intending it to work on directories, but from a simple look, it seems it might work? It just concats the location where it was cloned and the provided relative path and checking that it's still inside the repo, so could work.

It currently mostly works. But is this something I can rely on? Should I write a test for static_filename(..., '.')? Can I rely on static_filename(...).parent containing a file's siblings?

  • Hm... Now that's interesting. Do you mean like how long before Arca deletes the file? That would be until a pull is performed and the file is deleted in the new commits, but obviously the file can change underneath... So when single pull is disabled, in theory on each static_filename call there could be a new file there if there are new commits every time...

I'm not looking for analysis of the current behavior, but for an interface specification. Something I can rely on when building on top of Arca; something we both agree shouldn't break in newer versions.
(Ideally it'd also be documented and tested, but that can come later.) (And hopefully it'll be some simple rule, so the current and future implementations are easy to check.)

Right now I'm not sure what the lifetime is intended to be. Until the next call to Arca?

@mikicz
Copy link
Member

mikicz commented Jan 21, 2019

It currently mostly works. But is this something I can rely on? Should I write a test for static_filename(..., '.')? Can I rely on static_filename(...).parent containing a file's siblings?

Yes, I think you should be able to rely on that. Arca's not messing around with the structure of the repository, so yes, static_filename(...).parent should contain the siblings.

Right now I'm not sure what the lifetime is intended to be. Until the next call to Arca?

When single_pull is enabled than the lifetime is until a new pull (triggered by either a new init of Arca or by calling the method), otherwise the lifetime is until next call of static_filename or run (since either can trigger a new pull -> files can change)

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

No branches or pull requests

2 participants