Package com.artipie.composer
Interface Repository
- All Known Implementing Classes:
AstoRepository
public interface Repository
PHP Composer repository.
- Since:
- 0.3
-
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.
-
Method Details
-
packages
CompletionStage<Optional<Packages>> packages()Reads packages description from storage.- Returns:
- Packages found by name, might be empty.
-
packages
Reads packages description from storage.- Parameters:
name
- Package name.- Returns:
- Packages found by name, might be empty.
-
addJson
Adds package described in JSON format from storage.- Parameters:
content
- Package content.version
- 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
Adds package described in archive with ZIP or TAR.GZ format from storage.- Parameters:
archive
- Archive with package content.content
- Package content.- Returns:
- Completion of adding package to repository.
-
value
Obtain bytes by key.- Parameters:
key
- The key- Returns:
- Bytes.
-
storage
Storage storage()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.- Returns:
- Storage instance
-
exists
This file exists?- Parameters:
key
- The key (file name)- Returns:
- TRUE if exists, FALSE otherwise
-
save
Saves the bytes to the specified key.- Parameters:
key
- The keycontent
- Bytes to save- Returns:
- Completion or error signal.
-
move
Moves value from one location to another.- Parameters:
source
- Source key.destination
- Destination key.- Returns:
- Completion or error signal.
-
delete
Removes value from storage. Fails if value does not exist.- Parameters:
key
- Key for value to be deleted.- Returns:
- Completion or error signal.
-
exclusively
Runs operation exclusively for specified key.- Type Parameters:
T
- Operation result type.- Parameters:
key
- Key which is scope of operation.operation
- Operation to be performed exclusively.- Returns:
- Result of operation.
-