Liking cljdoc? Tell your friends :D

com.fulcrologic.rad.blob-storage

The protocol and a sample implementation of binary large object storage. Blob storage is used by the file upload support to first place files in a temporary holding area, and then support moving them to a more permanent store if/when the form that refers to the file is saved. Of course, storage can be persistent and just skip the transient bits if you don't need to track the files in some other kind of database.

The protocol and a sample implementation of binary large object storage. Blob storage is used by the file upload
support to first place files in a temporary holding area, and then support moving them to a more permanent store
if/when the form that refers to the file is saved.  Of course, storage can be persistent and just skip the
transient bits if you don't need to track the files in some other kind of database.
raw docstring

Storagecljprotocol

blob-exists?clj

(blob-exists? this name)

Returns true if the SHA already exists in the store

Returns true if the SHA already exists in the store

blob-streamclj

(blob-stream this name)

Returns an open InputStream for the given blob with name. You must close it (use with-open).

Returns an open InputStream for the given blob with name. You must close it (use with-open).

blob-urlclj

(blob-url this name)

Return a global URL for the file content.

Return a global URL for the file content.

delete-blob!clj

(delete-blob! this name)

Delete the given thing from storage by name.

Delete the given thing from storage by name.

move-blob!clj

(move-blob! this name target-storage)

Move the blob with the given name from this store to a target store.

Move the blob with the given name from this store to a target store.

save-blob!clj

(save-blob! this name input-stream)

Save the data from an InputStream as the given name. This function does not close the stream.

Save the data from an InputStream as the given name. This function does not close the stream.
source

transient-blob-storeclj

(transient-blob-store base-url max-store-mins)

Create a blob store that uses a map of entries to track file uploads and saves the actual files to local temp files on disk. The max-store-mins is a time (in minutes) after which blobs in this store will disappear.

This store is useful as the temporary store for file uploads on forms that have not yet been saved. Be sure to set the time high enough that it won't clean up uploaded things that have not been put in the database yet. You might also think about adding auto-save to forms that have uploads.

This store can also be used as a development-time store if you're ok with them disappearing on restarts.

  • base-url is the prefix to use for returning URLs for a blob in this store.
  • max-store-mins is the maximum time after which files will be removed from disk.

NOTE: file cleanup happens on the next save-blob!. Restarting the server can cause some of the temporary files that were being tracked by this store to be left on disk.

Create a blob store that uses a map of entries to track file uploads and saves the actual files to local
temp files on disk. The `max-store-mins` is a time (in minutes) after which blobs in this store will disappear.

This store is useful as the temporary store for file uploads on forms that have not yet been saved. Be sure to set
the time high enough that it won't clean up uploaded things that have not been put in the database yet. You might
also think about adding auto-save to forms that have uploads.

This store can also be used as a development-time store if you're ok with them disappearing on restarts.

* `base-url` is the prefix to use for returning URLs for a blob in this store.
* `max-store-mins` is the maximum time after which files will be removed from disk.

NOTE: file cleanup happens on the next `save-blob!`. Restarting the server can cause some of the temporary files
that were being tracked by this store to be left on disk.
sourceraw docstring

TransientBlobStoreclj

source

cljdoc is a website building & hosting documentation for Clojure/Script libraries

× close