A DSR practise project.
This project is a server application that provides file system and operations over it. Basically its RMCD (Read, Move, Copy, Delete) service for files and directories.
Project is separated on core
and service
modules:
core
- implements main operations over paths (files and directories). Additional feature isConcurrentIo
that provides interaction with program-wide concurrency.service
- spring based RESTlike service. Extendscore
module withvirtual_fs
package provides encapsulation of server file system via publish specific paths.
- Clone project code sources into some directory (for example let it be
your_fs4r_dir
). - Open
your_fs4r_dir
as gradle based project in your favorite IDE. - Verify code by running gradle
check
task. Alternatively you can achieve it by runningtest
task fromyour_fs4r_dir/build.gradle
.
- Run
bootJar
task fromyour_fs4r_dir/service/build.gradle
. - Built jar file is stored in
your_fs4r_dir/service/build/libs
directory with name likefs4r-service-[VERSION].jar
- Run it with command
java -jar fs4r-service-[VERSION].jar
. Append it with required arguments like path to resources or active profiles.
Run 'docker pull ghcr.io/vanderkast/fs4r/fs4rservice:[VERSION]
. Checkout repository for version, use latest
for
lattest stable.
- To create Docker image run
docker build .
command inyour_fs4r_dir
directory. Image name isfs4r-service
. - Run image with command
docker run -p [PORT]:8080 fs4r-service
. Append it with required arguments after keywordARG
.
You may specify service behavior with profiles, pass them as spring.profiles.active
property:
concurrent-sessions
- enables extended concurrency support with stamp based locks. Read more in [Concurrency support](#Concurrency support) section.
Service supports Spring properties (server.port
, logging.level
, etc.).
fs4r.publish-dirs
- service publish paths. If passed more than one path, service creates virtual root directory that wraps published files.fs4r.web.allowed-origins
- specifies origins allowed interacting with service. CORSfs4r.load-files-size-limit
- specifies file size limit (in bytes) for loading via/main/load/**
endpointfs4r.security.reader-password
- specifies password for user withREAD
authority. (default: {bcrypt}$2y$12$4z8y0T6R.5aYu7HpqzPkE.pQF9twkbeSHnY5UoOEDMtKCbh0KPJ4q ~ 123)fs4r.security.regular-password
- specifies password for user withREAD
/WRITE
authorities. (default: {bcrypt}$2y$12$5GBgieTpZsK5ASKWSlS9T.ef0ZdUlR6mLv0aRZSobQ.FtsmdwVyCa ~ 321)
Service provides two levels of concurrency:
- [Thread level](#Threads concurrency support) - is activated in any case without being tied to a configuration.
- [Request level](#Sessions concurrency support) - is activated by profile
concurrent-sessions
.
Basic concurrency support. When some thread tries to operate over real path, it requests read/write lock on that path.
Extended concurrency support. Is enabled with profile concurrent-sessions
, and provides concurrency support for
request/sessions via stamp based locks on virtual paths.
When user wants to guard some virtual paths, it requests exclusive/concurrent lock over that paths. Exclusive lock
guarantees that no other user will be allowed to read and modify target path. Concurrent lock allows other user to read
target path and request concurrent lock on it, but prevents exclusive locking and modifying.
- Valentine Mazurov - code, bugs, etc
- Александр Мартынов - DSR practice mentor