Interface Repository

All Known Implementing Classes:
AstoRepository

public interface Repository
PHP Composer repository.
Since:
0.3
  • Method Details

    • 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

      CompletableFuture<Void> addJson(Content content, Optional<String> version)
      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

      CompletableFuture<Void> addArchive(Archive archive, Content content)
      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 where Storage 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

      CompletableFuture<Void> save(Key key, Content content)
      Saves the bytes to the specified key.
      Parameters:
      key - The key
      content - Bytes to save
      Returns:
      Completion or error signal.
    • move

      CompletableFuture<Void> move(Key source, Key destination)
      Moves value from one location to another.
      Parameters:
      source - Source key.
      destination - Destination key.
      Returns:
      Completion or error signal.
    • delete

      CompletableFuture<Void> delete(Key key)
      Removes value from storage. Fails if value does not exist.
      Parameters:
      key - Key for value to be deleted.
      Returns:
      Completion or error signal.
    • exclusively

      <T> CompletionStage<T> exclusively(Key key, Function<Storage,CompletionStage<T>> operation)
      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.