mirror of https://github.com/hwchase17/langchain
langchain[minor]: enhance `LocalFileStore` to allow directory/file permissions to be specified (#18857)
**Description:** The `LocalFileStore` class can be used to create an on-disk `CacheBackedEmbeddings` cache. However, the default `umask` settings gives file/directory write permissions only to the original user. Once the cache directory is created by the first user, other users cannot write their own cache entries into the directory. To make the cache usable by multiple users, this pull request updates the `LocalFileStore` constructor to allow the permissions for newly created directories and files to be specified. The specified permissions override the default `umask` values. For example, when configured as follows: ```python file_store = LocalFileStore(temp_dir, chmod_dir=0o770, chmod_file=0o660) ``` then "user" and "group" (but not "other") have permissions to access the store, which means: * Anyone in our group could contribute embeddings to the cache. * If we implement cache cleanup/eviction in the future, anyone in our group could perform the cleanup. The default values for the `chmod_dir` and `chmod_file` parameters is `None`, which retains the original behavior of using the default `umask` settings. **Issue:** Implements enhancement #18075. **Testing:** I updated the `LocalFileStore` unit tests to test the permissions. --------- Signed-off-by: chrispy <chrispy@synopsys.com> Co-authored-by: Eugene Yurtsev <eyurtsev@gmail.com>pull/19972/head^2
parent
df25829f33
commit
a954dedb77
Loading…
Reference in New Issue