This is the nfiles Reference Manual, version 1.1.4, generated automatically by Declt version 4.0 beta 2 "William Riker" on Sun Jul 13 21:22:39 2025 GMT+0.
The main system appears first, followed by any subsystem dependency.
nfiles
Manage file persistence and loading.
Atlas Engineer LLC
(GIT https://github.com/atlas-engineer/nfiles.git)
BSD 3-Clause
1.1.4
alexandria
(system).
nclasses
(system).
quri
(system).
serapeum
(system).
trivial-garbage
(system).
trivial-package-local-nicknames
(system).
trivial-types
(system).
pathname-helpers.lisp
(file).
package.lisp
(file).
conditions.lisp
(file).
gpg.lisp
(file).
nfiles.lisp
(file).
Files are sorted by type and then listed depth-first from the systems components trees.
nfiles/nfiles.asd
nfiles/pathname-helpers.lisp
nfiles/package.lisp
nfiles/conditions.lisp
nfiles/gpg.lisp
nfiles/nfiles.lisp
nfiles/pathname-helpers.lisp
nfiles
(system).
basename
(function).
directory-pathname-p
(function).
ensure-type
(function).
file-group
(function).
(setf file-group)
(function).
file-user
(function).
(setf file-user)
(function).
join
(function).
nil-pathname-p
(function).
parent
(function).
pathname-type*
(function).
permissions
(function).
(setf permissions)
(function).
+permissions+
(constant).
special-pathname-namestring-p
(function).
nfiles/conditions.lisp
nfiles
(system).
external-modification
(condition).
fetch-error
(condition).
invalid-checksum
(condition).
process-error
(condition).
read-error
(condition).
nfiles/gpg.lisp
nfiles
(system).
*gpg-default-recipient*
(special variable).
*gpg-program*
(special variable).
algorithm
(reader method).
(setf algorithm)
(writer method).
creation-date
(reader method).
(setf creation-date)
(writer method).
expiry-date
(reader method).
(setf expiry-date)
(writer method).
fingerprint
(reader method).
(setf fingerprint)
(writer method).
gpg-key
(class).
gpg-private-keys
(function).
gpg-uid
(class).
key-id
(reader method).
(setf key-id)
(writer method).
key-length
(reader method).
(setf key-length)
(writer method).
keygrip
(reader method).
(setf keygrip)
(writer method).
uids
(reader method).
(setf uids)
(writer method).
user-id
(reader method).
(setf user-id)
(writer method).
validity
(reader method).
(setf validity)
(writer method).
with-gpg-file
(macro).
call-with-gpg-file
(function).
gpg-key-p
(generic function).
gpg-recipient
(function).
gpg-uid-p
(generic function).
gpg-write
(function).
parse-gpg-secret-keys-output
(function).
read-new-value
(function).
run-program*
(function).
nfiles/nfiles.lisp
nfiles
(system).
*default-profile*
(special variable).
all-files
(function).
ask
(function).
backup
(function).
base-path
(reader method).
cache-file
(class).
check
(generic function).
checksum
(reader method).
(setf checksum)
(writer method).
config-file
(class).
content
(function).
(setf content)
(function).
data-file
(class).
delete
(function).
deserialize
(generic function).
discard
(function).
ensure-file-exists
(function).
expand
(function).
fetch
(generic function).
file
(class).
gpg-file
(class).
gpg-lisp-file
(class).
ignore-checksum
(function).
initialize-instance
(method).
initialize-instance
(method).
lisp-file
(class).
name
(reader method).
name
(reader method).
(setf name)
(writer method).
(setf name)
(writer method).
on-deserialization-error
(reader method).
(setf on-deserialization-error)
(writer method).
on-external-modification
(reader method).
(setf on-external-modification)
(writer method).
on-fetch-error
(reader method).
(setf on-fetch-error)
(writer method).
on-invalid-checksum
(reader method).
(setf on-invalid-checksum)
(writer method).
on-read-error
(reader method).
(setf on-read-error)
(writer method).
overwrite
(function).
profile
(reader method).
profile
(class).
read-file
(generic function).
read-handler
(reader method).
(setf read-handler)
(writer method).
read-only-file
(class).
read-only-profile
(class).
reload
(function).
remote-file
(class).
resolve
(generic function).
runtime-file
(class).
serialize
(generic function).
update-interval
(reader method).
(setf update-interval)
(writer method).
url
(reader method).
(setf url)
(writer method).
url-content
(reader method).
(setf url-content)
(writer method).
virtual-file
(class).
virtual-profile
(class).
with-file-content
(macro).
with-paths
(macro).
write-file
(generic function).
write-handler
(reader method).
(setf write-handler)
(writer method).
*cache*
(special variable).
*cache-entry-override*
(special variable).
*content-override*
(special variable).
*index*
(special variable).
*timeout*
(special variable).
auto-restarter
(function).
back-up
(function).
cache-entry
(function).
cache-entry
(class).
cache-entry-p
(generic function).
cache-file-p
(generic function).
cached-value
(reader method).
(setf cached-value)
(writer method).
clear-cache
(function).
config-file-p
(generic function).
data-file-p
(generic function).
drain-semaphore
(function).
expand-user-home
(function).
file-key
(function).
filep
(generic function).
gpg-file-p
(generic function).
gpg-lisp-file-p
(generic function).
gpg-path-p
(function).
last-update
(reader method).
last-update
(reader method).
(setf last-update)
(writer method).
lisp-file-p
(generic function).
maybe-xdg
(function).
profilep
(generic function).
read-only-file-p
(generic function).
read-only-profile-p
(generic function).
remote-file-p
(generic function).
run-thread
(macro).
runtime-file-p
(generic function).
source-file
(reader method).
(setf source-file)
(writer method).
try-restart
(function).
updatable-p
(function).
url-empty-p
(function).
virtual-file-p
(generic function).
virtual-profile-p
(generic function).
worker
(reader method).
(setf worker)
(writer method).
worker-notifier
(reader method).
(setf worker-notifier)
(writer method).
worker-write
(function).
write-cache-entry
(function).
Packages are listed by definition order.
nfiles/gpg
A thin wrapper around the GPG command line tool. Do not expect too much from it.
common-lisp
.
*gpg-default-recipient*
(special variable).
*gpg-program*
(special variable).
algorithm
(generic reader).
(setf algorithm)
(generic writer).
creation-date
(generic reader).
(setf creation-date)
(generic writer).
expiry-date
(generic reader).
(setf expiry-date)
(generic writer).
fingerprint
(generic reader).
(setf fingerprint)
(generic writer).
gpg-key
(class).
gpg-private-keys
(function).
gpg-uid
(class).
key-id
(generic reader).
(setf key-id)
(generic writer).
key-length
(generic reader).
(setf key-length)
(generic writer).
keygrip
(generic reader).
(setf keygrip)
(generic writer).
uids
(generic reader).
(setf uids)
(generic writer).
user-id
(generic reader).
(setf user-id)
(generic writer).
validity
(generic reader).
(setf validity)
(generic writer).
with-gpg-file
(macro).
call-with-gpg-file
(function).
gpg-key-p
(generic function).
gpg-recipient
(function).
gpg-uid-p
(generic function).
gpg-write
(function).
parse-gpg-secret-keys-output
(function).
read-new-value
(function).
run-program*
(function).
nfiles
The main data structures are ‘nfiles:file’ and ‘nfiles:profile’.
Call ‘nfiles:expand’ to return the final ‘nfiles:file’ path.
Call ‘nfiles:content’ (setf-able) to get the ‘nfiles:file’ content.
A basic session:
(defvar *config-file* (make-instance ’nfiles:config-file :base-path #p"my-app/init.lisp"))
(nfiles:expand *config-file*)
; => #P"/home/johndoe/.config/my-app/init.lisp"
(setf (nfiles:content *config-file*) "Hello file!") ; The file is written to disk.
(nfiles:content *config-file*)
; => "Hello file!"
The following convenience macro ensures the file is updated when done with the
body:
(nfiles:with-file-content (content *config-file*)
(format t "Length: ~a~%" (length content))
(setf content (serapeum:string-replace "file" content "config")))
The ‘nfiles:with-paths’ helper allows for let-style bindings of the expanded paths:
(let ((file1 (make-instance ’nfiles:file))
(file2 (make-instance ’nfiles:file :base-path #p"alt")))
(nfiles:with-paths ((path1 file1)
(path2 file2))
(list path1 path2)))
Specialize ‘nfiles:resolve’ to configure how a file path is expanded depending
on the file type and the ‘nfiles:profile’.
The content serialization and deserialization can be specialized via the
‘nfiles:serialize’ and ‘nfiles:deserialize’ methods.
The file reading and writing can be specialized via the ‘nfiles:read-file’ and
‘nfiles:write-file’ methods. These specializations are in charge for calling
the (de)serialization methods.
A ‘nfiles:remote-file’ works the same but needs some specialization to handle
the remote fetching and checksum validation:
(defmethod nfiles:fetch ((profile nfiles:profile) (file remote-counter-file) &key)
(dex:get (nfiles:url file)))
;; Optional:
(defmethod nfiles:check ((profile nfiles:profile) (file remote-counter-file) content &key)
(let ((path (nfiles:expand file)))
(ironclad:byte-array-to-hex-string
(ironclad:digest-file :sha3 path))))
(let ((file (make-instance ’nfiles:remote-file
;; The URL to download from if the file is not found on disk.
:url (quri:uri "https://example.org")
;; Without base-path, the file won’t be saved to disk.
:base-path #p"/tmp/index.html"
:checksum "794df316afac91572b899b52b54f53f04ef71f275a01c44b776013573445868c95317fc4a173a973e90addec7792ff8b637bdd80b1a6c60b03814a6544652a90")))
;; On access, file is automatically downloaded if needed and the checksum is verified:
(nfiles:content file)
;; ...
)
A word of caution: sometimes you may need the handle both the raw form and the
deserialized form. Then what should ‘nfiles:content’ return?
In this use case, your class has 2 semantic values: that of carrying the raw
form and that of being an ‘nfiels:file’ which carries the deserialized form.
To keep things simple, use a dedicated slot to store the raw form.
For instance ‘nfiles:remote-file’ has a ‘nfiles:url-content’ slot. If your file
is stored remotely, a ‘nfiles:remote-file’ gives access to both forms.
Also avoid calling ‘nfiles:content’ (or its setf-function) in the
‘nfiles:read-file’ - ‘nfiles:deserialize’ / ‘nfiles:write-file’ -
‘nfiles:serialize’ pipeline as it would make it horribly confusing to the
user (and probably break the logic).
common-lisp
.
nfiles/pathname
.
*default-profile*
(special variable).
all-files
(function).
ask
(function).
backup
(function).
base-path
(generic reader).
cache-file
(class).
check
(generic function).
checksum
(generic reader).
(setf checksum)
(generic writer).
config-file
(class).
content
(function).
(setf content)
(function).
data-file
(class).
delete
(function).
deserialize
(generic function).
discard
(function).
ensure-file-exists
(function).
expand
(function).
external-modification
(condition).
fetch
(generic function).
fetch-error
(condition).
file
(class).
gpg-file
(class).
gpg-lisp-file
(class).
ignore-checksum
(function).
invalid-checksum
(condition).
lisp-file
(class).
name
(generic reader).
(setf name)
(generic writer).
on-deserialization-error
(generic reader).
(setf on-deserialization-error)
(generic writer).
on-external-modification
(generic reader).
(setf on-external-modification)
(generic writer).
on-fetch-error
(generic reader).
(setf on-fetch-error)
(generic writer).
on-invalid-checksum
(generic reader).
(setf on-invalid-checksum)
(generic writer).
on-read-error
(generic reader).
(setf on-read-error)
(generic writer).
overwrite
(function).
process-error
(condition).
profile
(generic reader).
profile
(class).
read-file
(generic function).
read-handler
(generic reader).
(setf read-handler)
(generic writer).
read-only-file
(class).
read-only-profile
(class).
reload
(function).
remote-file
(class).
resolve
(generic function).
runtime-file
(class).
serialize
(generic function).
update-interval
(generic reader).
(setf update-interval)
(generic writer).
url
(generic reader).
(setf url)
(generic writer).
url-content
(generic reader).
(setf url-content)
(generic writer).
virtual-file
(class).
virtual-profile
(class).
with-file-content
(macro).
with-paths
(macro).
write-file
(generic function).
write-handler
(generic reader).
(setf write-handler)
(generic writer).
*cache*
(special variable).
*cache-entry-override*
(special variable).
*content-override*
(special variable).
*index*
(special variable).
*timeout*
(special variable).
auto-restarter
(function).
back-up
(function).
cache-entry
(function).
cache-entry
(class).
cache-entry-p
(generic function).
cache-file-p
(generic function).
cached-value
(generic reader).
(setf cached-value)
(generic writer).
clear-cache
(function).
config-file-p
(generic function).
data-file-p
(generic function).
drain-semaphore
(function).
expand-user-home
(function).
file-key
(function).
filep
(generic function).
gpg-file-p
(generic function).
gpg-lisp-file-p
(generic function).
gpg-path-p
(function).
last-update
(generic reader).
(setf last-update)
(generic writer).
lisp-file-p
(generic function).
maybe-xdg
(function).
profilep
(generic function).
read-error
(condition).
read-only-file-p
(generic function).
read-only-profile-p
(generic function).
remote-file-p
(generic function).
run-thread
(macro).
runtime-file-p
(generic function).
source-file
(generic reader).
(setf source-file)
(generic writer).
try-restart
(function).
updatable-p
(function).
url-empty-p
(function).
virtual-file-p
(generic function).
virtual-profile-p
(generic function).
worker
(generic reader).
(setf worker)
(generic writer).
worker-notifier
(generic reader).
(setf worker-notifier)
(generic writer).
worker-write
(function).
write-cache-entry
(function).
nfiles/pathname
Some ‘cl:pathname’ helpers.
common-lisp
.
basename
(function).
directory-pathname-p
(function).
ensure-type
(function).
file-group
(function).
(setf file-group)
(function).
file-user
(function).
(setf file-user)
(function).
join
(function).
nil-pathname-p
(function).
parent
(function).
pathname-type*
(function).
permissions
(function).
(setf permissions)
(function).
+permissions+
(constant).
special-pathname-namestring-p
(function).
Definitions are sorted by export status, category, package, and then by lexicographic order.
The fallback profile for files not having overriden one.
The default recipient (likely email) for the keys.
The program to use for GPG key management.
Bind CONTENT to FILE’s content in BODY.
In case there’s no content, bind CONTENT to DEFAULT.
The new value of CONTENT is saved to FILE on exit.
Trivial wrapper around ‘call-with-gpg-file’.
Bind let-style BINDINGS to ‘file’ path expansions, then run BODY if all these paths are non-nil after ‘nil-pathname-p’.
Return all instantiated ‘file’ objects belonging to PACKAGES. If no package is specified, return all ‘file’ objects.
Transfer control to a restart named ASK, or return NIL if none exists.
Transfer control to a restart named BACKUP, or return NIL if none exists.
Return the basename, that is:
- if it’s a directory, the name of the directory,
- if it’s a file, the name of the file including its type (extension),
- nil if it’s a nil-pathname (#p"").
Return the content of FILE.
When FORCE-READ is non-nil, the cache is skipped and the file is re-read.
When FORCE-UPDATE is non-nil, the file is re-downloaded if it’s a ‘remote-file’.
When SKIP-UPDATE is non-nil, the file is not re-downloaded if it’s present locally.
The read is asynchronous. By default, ‘content’ waits for the read to finish
before returning the result. But if ‘wait-p’ is nil, it returns directly
with (VALUES NIL THREAD) if the reading THREAD is not done yet.
Set FILE content to VALUE and persist change to disk.
While the content of the FILE object is updated instantly, the file is persisted
in the background.
This is a user-facing function, you should probably not try to call it from one
of the specialized methods as this would set the logic upside down.
Return a ‘bt:thread’ object. Call ‘bt:join-thread’ on it to know when it’s done writing the file.
Transfer control to a restart named DELETE, or return NIL if none exists.
Like ‘uiop:directory-pathname-p’ but also return T if ‘pathname-name’ is "." and check for existence.
Transfer control to a restart named DISCARD, or return NIL if none exists.
Create file PATHNAME unless it exists.
Return PATH with type set to TYPE, if it’s not already the case. Case is ignored.
Return the pathname corresponding to FILE and its ‘profile’.
It’s a convenience wrapper around ‘resolve’ (to avoid specifying the ‘profile’).
Return PATH group name.
Set PATH group to NEW-GROUP (a string).
Return PATH owner name.
Set PATH owner to NEW-USER (a string).
Return list of private ‘gpg-key’s.
Transfer control to a restart named IGNORE-CHECKSUM, or return NIL if none exists.
Concatenate PATHS.
Return non-nil if PATHNAME is ‘uiop:*nil-pathname*’ or nil.
Transfer control to a restart named OVERWRITE, or return NIL if none exists.
Return the parent directory of PATH.
Like ‘pathname-type’ but return NIL instead of "" or :UNSPECIFIC.
Return a list of permissions as per ‘+permissions+’.
Set the PERMISSIONS or PATH as per ‘+permissions+’.
Transfer control to a restart named RELOAD, or return NIL if none exists.
Auto-generated accessor function for slot ALGORITHM.
Auto-generated accessor function for slot ALGORITHM.
Auto-generated accessor function for slot BASE-PATH.
The pathname used by the ‘resolve’ method to yield the final path.
Check CONTENT when FILE’s ‘checksum’ is non-empty.
This is meant to return a string which is then automatically compared to ‘checksum’.
Auto-generated accessor function for slot CHECKSUM.
If non-empty, the ‘check’ method is called on download against the resulting data.
If it does not match the ‘checksum’, raise an error.
This probably only makes sense for immutable data, thus ‘update-interval’ ought to be 0.
remote-file
)) ¶remote-file
)) ¶If non-empty, the ‘check’ method is called on download against the resulting data.
If it does not match the ‘checksum’, raise an error.
This probably only makes sense for immutable data, thus ‘update-interval’ ought to be 0.
Auto-generated accessor function for slot CREATION-DATE. Stored as in Unix format.
Transform STREAM into a useful form ready to be manipulated on the Lisp side. The STREAM is provided by ‘read-file’.
See ‘serialize’ for the reverse action.
virtual-profile
) (file file
) stream &key) ¶profile
) (file virtual-file
) stream &key) ¶Auto-generated accessor function for slot EXPIRY-DATE. Stored as in Unix format.
Download the FILE ‘url’ and return the result as a string.
Auto-generated accessor function for slot FINGERPRINT.
Auto-generated accessor function for slot FINGERPRINT.
Auto-generated accessor function for slot KEY-ID.
Auto-generated accessor function for slot KEY-ID.
Auto-generated accessor function for slot KEY-LENGTH.
Auto-generated accessor function for slot KEY-LENGTH.
Auto-generated accessor function for slot KEYGRIP.
Auto-generated accessor function for slot KEYGRIP.
Auto-generated accessor function for slot NAME.
Name used to identify the object in a human-readable manner.
Auto-generated accessor function for slot ON-DESERIALIZATION-ERROR.
What to do on deserialization error.
The offending file may be backed up with the ‘backup’ function.
Or it may simply be ‘delete’d.
‘ask’ leaves the condition unhandled, so unless you handle it, it will prompt
the debugger with the other options.
file
)) ¶file
)) ¶What to do on deserialization error.
The offending file may be backed up with the ‘backup’ function.
Or it may simply be ‘delete’d.
‘ask’ leaves the condition unhandled, so unless you handle it, it will prompt
the debugger with the other options.
Auto-generated accessor function for slot ON-EXTERNAL-MODIFICATION. Whether to reload or overwrite the file if it was modified since it was last loaded.
Auto-generated accessor function for slot ON-FETCH-ERROR. What to do when the file download failed.
remote-file
)) ¶remote-file
)) ¶What to do when the file download failed.
Auto-generated accessor function for slot ON-INVALID-CHECKSUM. What to do when the downloaded content does not match ‘checksum’.
remote-file
)) ¶remote-file
)) ¶What to do when the downloaded content does not match ‘checksum’.
Auto-generated accessor function for slot ON-READ-ERROR.
What to do on file read error.
See ‘on-deserialization-error’ for the meaning of the different actions.
Auto-generated accessor function for slot PROFILE.
The ‘profile’ of the ‘file’.
File expansion is performed against it.
The profile is only set at instantiation time.
Load FILE by calling ‘deserialize’ on a stream opened on the file. The specialized method is in charge for calling ‘deserialize’. See ‘write-file’ for the reverse action.
virtual-profile
) (file file
) &key) ¶Don’t load anything when using the ‘virtual-profile’.
profile
) (file virtual-file
) &key) ¶Don’t load anything for virtual files.
profile
) (file gpg-file
) &key) ¶Decrypt FILE with GPG and return resulting stream. See ‘*gpg-default-recipient*’.
profile
) (file file
) &key) ¶Open FILE and call ‘deserialize’ on its content.
profile
) (file remote-file
) &key force-update skip-update) ¶Try to download the file from its ‘url’ if it does not exist.
If file is already on disk and younger than ‘update-interval’, call next ‘read-file’ method instead of fetching online.
Auto-generated accessor function for slot READ-HANDLER. Function of one argument, the condition that may be raised in the reader thread.
Return the final expanded path for ‘file’ depending on its ‘profile’.
This method is meant to be specialized against the user-defined ‘profile’s and ‘file’s.
See ‘expand’ for a convenience wrapper.
profile
) (file runtime-file
)) ¶profile
) (file cache-file
)) ¶profile
) (file config-file
)) ¶virtual-profile
) (file file
)) ¶Virtual files are in-memory only.
profile
) (file gpg-lisp-file
)) ¶Ensure the extension is .lisp or .lisp.gpg.
Transform ‘file’ content in a form meant to be persisted to a file.
For the actual writing to disk, see ‘write-file’.
See ‘deserialize’ for the reverse action.
read-only-profile
) (file file
) stream &key) ¶profile
) (file read-only-file
) stream &key) ¶Auto-generated accessor function for slot UIDS.
Auto-generated accessor function for slot UIDS.
Auto-generated accessor function for slot UPDATE-INTERVAL.
Re-download the file after this amount of seconds has
elapsed since last update.
If 0, disable automatic re-download.
remote-file
)) ¶remote-file
)) ¶Re-download the file after this amount of seconds has
elapsed since last update.
If 0, disable automatic re-download.
Auto-generated accessor function for slot URL.
URL from where to download the file.
If empty, then this behaves just like a regular ‘file’.
remote-file
)) ¶remote-file
)) ¶URL from where to download the file.
If empty, then this behaves just like a regular ‘file’.
url
.
Auto-generated accessor function for slot URL-CONTENT.
The content of the downloaded file.
This is useful if you want to maintain both the raw content and the deserialized
content.
remote-file
)) ¶remote-file
)) ¶The content of the downloaded file.
This is useful if you want to maintain both the raw content and the deserialized
content.
Auto-generated accessor function for slot USER-ID.
Auto-generated accessor function for slot USER-ID.
Auto-generated accessor function for slot VALIDITY.
Auto-generated accessor function for slot VALIDITY.
Persist FILE to disk.
DESTINATION is set by default to a staged pathname (using
‘uiop:with-staging-pathname’) which is renamed to the final name (the result of
‘expand’ on FILE) if everything went well.
This guarantees that on error the original file is left untouched.
The specialized method is in charge for calling ‘serialize’.
See ‘read-file’ for the reverse action.
read-only-profile
) (file file
) &key destination) ¶Don’t write anything when using the ‘read-only-profile’.
profile
) (file read-only-file
) &key destination) ¶Don’t write anything for ‘read-only-file’.
profile
) (file gpg-file
) &key destination) ¶Crypt to FILE with GPG. See ‘*gpg-default-recipient*’.
Auto-generated accessor function for slot WRITE-HANDLER. Function of one argument, the condition that may be raised in the writer thread.
cache-entry
) &key force-update skip-update) ¶Modification of the file that NFiles is not responsible for.
error
.
:path
Problem when fetching remote file.
Checksum of the file content doesn’t match the initially provided one.
Error happening when ‘uiop:run-program’ exits abnormally. Wrapper around ‘uiop:subprocess-error’.
subprocess-error
.
:message
Like regular ‘file’ but set directory to ‘uiop:xdg-cache-home’
file
.
Like regular ‘file’ but set directory to ‘uiop:xdg-config-home’.
file
.
Like regular ‘file’ but set directory to ‘uiop:xdg-data-home’
file
.
The main object to manipulate and subclass.
The ‘profile’ slot can be used to drive the specializations of multiple ‘file’
methods. See ‘resolve’, ‘serialize’, etc.
The ‘name’ slot can be used to refer to ‘file’ objects in a human-readable fashion.
base-path
.
check
.
deserialize
.
deserialize
.
deserialize
.
initialize-instance
.
(setf name)
.
name
.
(setf on-deserialization-error)
.
on-deserialization-error
.
(setf on-external-modification)
.
on-external-modification
.
(setf on-read-error)
.
on-read-error
.
profile
.
read-file
.
read-file
.
read-file
.
(setf read-handler)
.
read-handler
.
resolve
.
resolve
.
resolve
.
serialize
.
serialize
.
serialize
.
write-file
.
write-file
.
write-file
.
(setf write-handler)
.
write-handler
.
The pathname used by the ‘resolve’ method to yield the final path.
pathname
#p"."
This slot is read-only.
The ‘profile’ of the ‘file’.
File expansion is performed against it.
The profile is only set at instantiation time.
nfiles:profile
nfiles:*default-profile*
:profile
This slot is read-only.
Name used to identify the object in a human-readable manner.
string
""
:name
name
.
Function of one argument, the condition that may be raised in the reader thread.
trivial-types:function-designator
(function identity)
:read-handler
Function of one argument, the condition that may be raised in the writer thread.
trivial-types:function-designator
(function identity)
:write-handler
Whether to reload or overwrite the file if it was modified since it was last loaded.
symbol
(quote nfiles:ask)
:on-external-modification
What to do on deserialization error.
The offending file may be backed up with the ‘backup’ function.
Or it may simply be ‘delete’d.
‘ask’ leaves the condition unhandled, so unless you handle it, it will prompt
the debugger with the other options.
symbol
(quote nfiles:ask)
:on-deserialization-error
What to do on file read error.
See ‘on-deserialization-error’ for the meaning of the different actions.
symbol
(quote nfiles:ask)
:on-read-error
If the resolved path has the GPG type (extension), the file is automatically encrypted and decrypted using the specified recipient key.
See ‘nfiles/gpg:*gpg-default-recipient*’.
file
.
Representation of GPG key as given by ‘*gpg-program*’.
:key-length
:algorithm
:key-id
Stored as in Unix format.
:creation-date
Stored as in Unix format.
:expiry-date
:fingerprint
:keygrip
If the resolved path has the GPG type (extension), the file is automatically encrypted and decrypted using the specified recipient key.
The ’.lisp’ extension is automatically added if missing.
User ID for the given GPG key.
Like regular ‘file’ but assume a ‘.lisp’ extension, even if not provided.
file
.
This is the default profile.
Subclass this profile to make your own, possibly carrying more data.
‘file’ path expansion is specialized against its ‘profile’ slot through the ‘resolve’ method.
File that’s not written to on change.
Note that the file’s ‘content’ can still be modified in-memory.
file
.
In this profile, files by default don’t get written to.
File which can be found on a remote system or online.
If the local file is not found, then an attempt is made at downloading the file using ‘fetch’.
file
.
URL from where to download the file.
If empty, then this behaves just like a regular ‘file’.
quri.uri:uri
(quri.uri:uri "")
:url
url
.
The content of the downloaded file.
This is useful if you want to maintain both the raw content and the deserialized
content.
string
""
:url-content
Last time the file was downloaded.
unsigned-byte
(get-universal-time)
:last-update
This slot is read-only.
Re-download the file after this amount of seconds has
elapsed since last update.
If 0, disable automatic re-download.
unsigned-byte
0
:update-interval
If non-empty, the ‘check’ method is called on download against the resulting data.
If it does not match the ‘checksum’, raise an error.
This probably only makes sense for immutable data, thus ‘update-interval’ ought to be 0.
string
""
:checksum
What to do when the downloaded content does not match ‘checksum’.
symbol
(quote nfiles:ask)
:on-invalid-checksum
What to do when the file download failed.
symbol
(quote nfiles:ask)
:on-fetch-error
Like regular ‘file’ but set directory to ‘uiop:xdg-runtime-dir’
file
.
File that’s not read nor written to.
Virtual files are useful when you only need dynamic path expansion, while the
read-and-write business is handled by a third party.
You can nonetheless store data in-memory if needed.
Note that if multiple ‘virtual-file’s expand to the same path, they share the
same content.
To disable content-sharing for a specific ‘file’, their ‘resolve’ method should return ‘uiop:*nil-pathname*’.
In this profile, files are neither read nor written to by default.
Their path expands to #p"".
If you want to know where a ‘file’ would have expanded in another profile, use ‘resolve’.
Internal ‘*cache*’ associating expanded paths with a dedicated ‘cache-entry’.
Implementation detail.
This is used by ‘remote-file’ to write content to disk when the ‘cache-entry’ is
initialized, without looping indefinitely.
Implementation detail.
This is used by ‘remote-file’ to write content to disk when the ‘cache-entry’ is
initialized, without looping indefinitely.
Set of all ‘file’ objects.
It’s a weak hash table so that garbage-collected files are automatically
removed.
Time in seconds to wait for other write requests.
Return a function that calls RESTARTER.
RESTARTER is a function that invokes a given restart if valid.
See ‘ask’ for instance.
Rename PATH to a file of the same name with a unique suffix appended. The file is guaranteed to not conflict with any existing file.
Files that expand to ‘uiop:*nil-pathname*’ have their own cache entry.
Like ‘call-with-open-file’ but use ‘gpg’ to read and write to file.
OPTIONS are as for ‘open”s ‘:direction’.
Other options are not supported. File is overwritten if it exists, while
nothing is done if file is missing.
Decrement the semaphore counter down to 0.
Return the number of decrements, or NIL if there was none.
Return the key of FILE’s recipient if any, ‘*gpg-default-recipient*’ otherwise.
As second value the email.
As third value the name.
Write STREAM to GPG-FILE using RECIPIENT key. If RECIPIENT is not provided, use default key.
Return the list of sections as a list of strings.
PROMPT takes no trailing colon nor trailing space.
Like ‘uiop:run-program’ but raise a ‘nfiles:process-error’ on error.
Return non-nil if pathname is special like "." or "..". Note that this returns nil on #p"." and #p"..".
Small convenience function to check whether the given URL is empty.
Auto-generated predicate for whether OBJECT is an instance of ‘cache-entry’.
Auto-generated predicate for whether OBJECT is an instance of ‘cache-file’.
Auto-generated accessor function for slot CACHED-VALUE.
cache-entry
)) ¶automatically generated reader method
Auto-generated accessor function for slot CACHED-VALUE.
cache-entry
)) ¶automatically generated writer method
Auto-generated predicate for whether OBJECT is an instance of ‘config-file’.
Auto-generated predicate for whether OBJECT is an instance of ‘data-file’.
Auto-generated predicate for whether OBJECT is an instance of ‘file’.
Auto-generated predicate for whether OBJECT is an instance of ‘gpg-file’.
Auto-generated predicate for whether OBJECT is an instance of ‘gpg-key’.
Auto-generated predicate for whether OBJECT is an instance of ‘gpg-lisp-file’.
Auto-generated predicate for whether OBJECT is an instance of ‘gpg-uid’.
Auto-generated accessor function for slot LAST-UPDATE. The date at which the cache entry was last updated.
cache-entry
)) ¶cache-entry
)) ¶The date at which the cache entry was last updated.
remote-file
)) ¶Last time the file was downloaded.
Auto-generated predicate for whether OBJECT is an instance of ‘lisp-file’.
Auto-generated predicate for whether OBJECT is an instance of ‘profile’.
Auto-generated predicate for whether OBJECT is an instance of ‘read-only-file’.
Auto-generated predicate for whether OBJECT is an instance of ‘read-only-profile’.
Auto-generated predicate for whether OBJECT is an instance of ‘remote-file’.
Auto-generated predicate for whether OBJECT is an instance of ‘runtime-file’.
Auto-generated accessor function for slot SOURCE-FILE. This is the ‘file’ object that was used to instantiate the entry’s ‘cached-value’.
cache-entry
)) ¶cache-entry
)) ¶This is the ‘file’ object that was used to instantiate the entry’s ‘cached-value’.
Auto-generated predicate for whether OBJECT is an instance of ‘virtual-file’.
Auto-generated predicate for whether OBJECT is an instance of ‘virtual-profile’.
Auto-generated accessor function for slot WORKER.
cache-entry
)) ¶automatically generated reader method
Auto-generated accessor function for slot WORKER.
cache-entry
)) ¶automatically generated writer method
Auto-generated accessor function for slot WORKER-NOTIFIER.
cache-entry
)) ¶automatically generated reader method
Auto-generated accessor function for slot WORKER-NOTIFIER.
cache-entry
)) ¶automatically generated writer method
This condition is used internally to cancel a file read.
error
.
This is the ‘file’ object that was used to instantiate the entry’s ‘cached-value’.
nfiles:file
(error "source file must be given.")
:source-file
The date at which the cache entry was last updated.
unsigned-byte
(get-universal-time)
:last-update
:cached-value
(or null bordeaux-threads:thread)
:worker
(or null bordeaux-threads:semaphore)
:worker-notifier
Jump to: | (
A B C D E F G I J K L M N O P R S T U V W |
---|
Jump to: | (
A B C D E F G I J K L M N O P R S T U V W |
---|
Jump to: | *
+
A B C E F K L M N O P R S U V W |
---|
Jump to: | *
+
A B C E F K L M N O P R S U V W |
---|
Jump to: | C D E F G I L N P R S V |
---|
Jump to: | C D E F G I L N P R S V |
---|