Package com.artipie.composer
Class AstoRepository
java.lang.Object
com.artipie.composer.AstoRepository
- All Implemented Interfaces:
Repository
PHP Composer repository that stores packages in a
Storage
.-
Field Summary
-
Constructor Summary
ConstructorDescriptionAstoRepository
(Storage storage) Ctor.AstoRepository
(Storage storage, Optional<String> prefix) Ctor. -
Method Summary
Modifier and TypeMethodDescriptionaddArchive
(Archive archive, Content content) Adds package described in archive with ZIP or TAR.GZ format from storage.Adds package described in JSON format from storage.Removes value from storage.<T> CompletionStage
<T> exclusively
(Key key, Function<Storage, CompletionStage<T>> operation) Runs operation exclusively for specified key.This file exists?Moves value from one location to another.packages()
Reads packages description from storage.Reads packages description from storage.Saves the bytes to the specified key.storage()
Obtains storage for repository.Obtain bytes by key.
-
Field Details
-
ALL_PACKAGES
Key to all packages.
-
-
Constructor Details
-
AstoRepository
Ctor.- Parameters:
storage
- Storage to store all repository data.
-
AstoRepository
Ctor.- Parameters:
storage
- Storage to store all repository data.prefix
- Prefix with url for uploaded archive.
-
-
Method Details
-
packages
Description copied from interface:Repository
Reads packages description from storage.- Specified by:
packages
in interfaceRepository
- Returns:
- Packages found by name, might be empty.
-
packages
Description copied from interface:Repository
Reads packages description from storage.- Specified by:
packages
in interfaceRepository
- Parameters:
name
- Package name.- Returns:
- Packages found by name, might be empty.
-
addJson
Description copied from interface:Repository
Adds package described in JSON format from storage.- Specified by:
addJson
in interfaceRepository
- Parameters:
content
- Package content.vers
- Version in case of absence version in content with package. If package does not contain version, this value should be passed as a parameter.- Returns:
- Completion of adding package to repository.
-
addArchive
Description copied from interface:Repository
Adds package described in archive with ZIP or TAR.GZ format from storage.- Specified by:
addArchive
in interfaceRepository
- Parameters:
archive
- Archive with package content.content
- Package content.- Returns:
- Completion of adding package to repository.
-
value
Description copied from interface:Repository
Obtain bytes by key.- Specified by:
value
in interfaceRepository
- Parameters:
key
- The key- Returns:
- Bytes.
-
storage
Description copied from interface:Repository
Obtains storage for repository. It can be useful for implementation cache or in other places whereStorage
instance is required for using classes which are created in asto module.- Specified by:
storage
in interfaceRepository
- Returns:
- Storage instance
-
exists
Description copied from interface:Repository
This file exists?- Specified by:
exists
in interfaceRepository
- Parameters:
key
- The key (file name)- Returns:
- TRUE if exists, FALSE otherwise
-
save
Description copied from interface:Repository
Saves the bytes to the specified key.- Specified by:
save
in interfaceRepository
- Parameters:
key
- The keycontent
- Bytes to save- Returns:
- Completion or error signal.
-
exclusively
Description copied from interface:Repository
Runs operation exclusively for specified key.- Specified by:
exclusively
in interfaceRepository
- Type Parameters:
T
- Operation result type.- Parameters:
key
- Key which is scope of operation.operation
- Operation to be performed exclusively.- Returns:
- Result of operation.
-
move
Description copied from interface:Repository
Moves value from one location to another.- Specified by:
move
in interfaceRepository
- Parameters:
source
- Source key.destination
- Destination key.- Returns:
- Completion or error signal.
-
delete
Description copied from interface:Repository
Removes value from storage. Fails if value does not exist.- Specified by:
delete
in interfaceRepository
- Parameters:
key
- Key for value to be deleted.- Returns:
- Completion or error signal.
-