Class MongoGridFsClient


  • public class MongoGridFsClient
    extends Object
    • Constructor Detail

      • MongoGridFsClient

        public MongoGridFsClient​(io.vertx.ext.mongo.MongoGridFsClient delegate)
      • MongoGridFsClient

        public MongoGridFsClient​(Object delegate)
    • Method Detail

      • getDelegate

        public io.vertx.ext.mongo.MongoGridFsClient getDelegate()
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class Object
      • delete

        public io.smallrye.mutiny.Uni<Void> delete​(String id)
        Deletes a file by it's ID

        Unlike the bare Vert.x variant, this method returns a Uni. Don't forget to subscribe on it to trigger the operation.

        Parameters:
        id - the identifier of the file
        Returns:
        the uni firing the result of the operation when completed, or a failure if the operation failed.
      • deleteAndAwait

        public Void deleteAndAwait​(String id)
        Blocking variant of delete(String).

        This method waits for the completion of the underlying asynchronous operation. If the operation completes successfully, the result is returned, otherwise the failure is thrown (potentially wrapped in a RuntimeException).

        Parameters:
        id - the identifier of the file
        Returns:
        the Void instance produced by the operation.
      • deleteAndForget

        public MongoGridFsClient deleteAndForget​(String id)
        Variant of delete(String) that ignores the result of the operation.

        This method subscribes on the result of delete(String), but discards the outcome (item or failure). This method is useful to trigger the asynchronous operation from delete(String) but you don't need to compose it with other operations.

        Parameters:
        id - the identifier of the file
        Returns:
        the instance of MongoGridFsClient to chain method calls.
      • downloadByFileNameWithOptions

        public io.smallrye.mutiny.Uni<Long> downloadByFileNameWithOptions​(WriteStream<Buffer> stream,
                                                                          String fileName,
                                                                          io.vertx.ext.mongo.GridFsDownloadOptions options)
      • downloadByFileNameWithOptionsAndAwait

        public Long downloadByFileNameWithOptionsAndAwait​(WriteStream<Buffer> stream,
                                                          String fileName,
                                                          io.vertx.ext.mongo.GridFsDownloadOptions options)
      • downloadByFileNameWithOptionsAndForget

        public MongoGridFsClient downloadByFileNameWithOptionsAndForget​(WriteStream<Buffer> stream,
                                                                        String fileName,
                                                                        io.vertx.ext.mongo.GridFsDownloadOptions options)
      • downloadFile

        public io.smallrye.mutiny.Uni<Long> downloadFile​(String fileName)
        Downloads a file.

        Unlike the bare Vert.x variant, this method returns a Uni. Don't forget to subscribe on it to trigger the operation.

        Parameters:
        fileName - the name of the file to download
        Returns:
        the uni firing the result of the operation when completed, or a failure if the operation failed.
      • downloadFileAndAwait

        public Long downloadFileAndAwait​(String fileName)
        Blocking variant of downloadFile(String).

        This method waits for the completion of the underlying asynchronous operation. If the operation completes successfully, the result is returned, otherwise the failure is thrown (potentially wrapped in a RuntimeException).

        Parameters:
        fileName - the name of the file to download
        Returns:
        the Long instance produced by the operation.
      • downloadFileAndForget

        public MongoGridFsClient downloadFileAndForget​(String fileName)
        Variant of downloadFile(String) that ignores the result of the operation.

        This method subscribes on the result of downloadFile(String), but discards the outcome (item or failure). This method is useful to trigger the asynchronous operation from downloadFile(String) but you don't need to compose it with other operations.

        Parameters:
        fileName - the name of the file to download
        Returns:
        the instance of MongoGridFsClient to chain method calls.
      • downloadFileAs

        public io.smallrye.mutiny.Uni<Long> downloadFileAs​(String fileName,
                                                           String newFileName)
        Downloads a file and gives it a new name.

        Unlike the bare Vert.x variant, this method returns a Uni. Don't forget to subscribe on it to trigger the operation.

        Parameters:
        fileName - the name of the file to download
        newFileName - the name the file should be saved as
        Returns:
        the uni firing the result of the operation when completed, or a failure if the operation failed.
      • downloadFileAsAndAwait

        public Long downloadFileAsAndAwait​(String fileName,
                                           String newFileName)
        Blocking variant of downloadFileAs(String,String).

        This method waits for the completion of the underlying asynchronous operation. If the operation completes successfully, the result is returned, otherwise the failure is thrown (potentially wrapped in a RuntimeException).

        Parameters:
        fileName - the name of the file to download
        newFileName - the name the file should be saved as
        Returns:
        the Long instance produced by the operation.
      • downloadFileAsAndForget

        public MongoGridFsClient downloadFileAsAndForget​(String fileName,
                                                         String newFileName)
        Variant of downloadFileAs(String,String) that ignores the result of the operation.

        This method subscribes on the result of downloadFileAs(String,String), but discards the outcome (item or failure). This method is useful to trigger the asynchronous operation from downloadFileAs(String,String) but you don't need to compose it with other operations.

        Parameters:
        fileName - the name of the file to download
        newFileName - the name the file should be saved as
        Returns:
        the instance of MongoGridFsClient to chain method calls.
      • downloadFileByID

        public io.smallrye.mutiny.Uni<Long> downloadFileByID​(String id,
                                                             String fileName)
        Downloads a file using the ID generated by GridFs.

        Unlike the bare Vert.x variant, this method returns a Uni. Don't forget to subscribe on it to trigger the operation.

        Parameters:
        id - the GridFs Object ID of the file to download
        fileName -
        Returns:
        the uni firing the result of the operation when completed, or a failure if the operation failed.
      • downloadFileByIDAndAwait

        public Long downloadFileByIDAndAwait​(String id,
                                             String fileName)
        Blocking variant of downloadFileByID(String,String).

        This method waits for the completion of the underlying asynchronous operation. If the operation completes successfully, the result is returned, otherwise the failure is thrown (potentially wrapped in a RuntimeException).

        Parameters:
        id - the GridFs Object ID of the file to download
        fileName -
        Returns:
        the Long instance produced by the operation.
      • drop

        public io.smallrye.mutiny.Uni<Void> drop()
        Drops the entire file bucket with all of its contents

        Unlike the bare Vert.x variant, this method returns a Uni. Don't forget to subscribe on it to trigger the operation.

        Returns:
        the uni firing the result of the operation when completed, or a failure if the operation failed.
      • dropAndAwait

        public Void dropAndAwait()
        Blocking variant of drop().

        This method waits for the completion of the underlying asynchronous operation. If the operation completes successfully, the result is returned, otherwise the failure is thrown (potentially wrapped in a RuntimeException).

        Returns:
        the Void instance produced by the operation.
      • dropAndForget

        public MongoGridFsClient dropAndForget()
        Variant of drop() that ignores the result of the operation.

        This method subscribes on the result of drop(), but discards the outcome (item or failure). This method is useful to trigger the asynchronous operation from drop() but you don't need to compose it with other operations.

        Returns:
        the instance of MongoGridFsClient to chain method calls.
      • findAllIds

        public io.smallrye.mutiny.Uni<List<String>> findAllIds()
        Finds all file ids in the bucket

        Unlike the bare Vert.x variant, this method returns a Uni. Don't forget to subscribe on it to trigger the operation.

        Returns:
        the uni firing the result of the operation when completed, or a failure if the operation failed.
      • findAllIdsAndAwait

        public List<String> findAllIdsAndAwait()
        Blocking variant of findAllIds().

        This method waits for the completion of the underlying asynchronous operation. If the operation completes successfully, the result is returned, otherwise the failure is thrown (potentially wrapped in a RuntimeException).

        Returns:
        the List instance produced by the operation.
      • findAllIdsAndForget

        public MongoGridFsClient findAllIdsAndForget()
        Variant of findAllIds() that ignores the result of the operation.

        This method subscribes on the result of findAllIds(), but discards the outcome (item or failure). This method is useful to trigger the asynchronous operation from findAllIds() but you don't need to compose it with other operations.

        Returns:
        the instance of MongoGridFsClient to chain method calls.
      • findIds

        public io.smallrye.mutiny.Uni<List<String>> findIds​(io.vertx.core.json.JsonObject query)
        Finds all file ids that match a query.

        Unlike the bare Vert.x variant, this method returns a Uni. Don't forget to subscribe on it to trigger the operation.

        Parameters:
        query - a bson query expressed as json that will be used to match files
        Returns:
        the uni firing the result of the operation when completed, or a failure if the operation failed.
      • findIdsAndAwait

        public List<String> findIdsAndAwait​(io.vertx.core.json.JsonObject query)
        Blocking variant of findIds(JsonObject).

        This method waits for the completion of the underlying asynchronous operation. If the operation completes successfully, the result is returned, otherwise the failure is thrown (potentially wrapped in a RuntimeException).

        Parameters:
        query - a bson query expressed as json that will be used to match files
        Returns:
        the List instance produced by the operation.
      • findIdsAndForget

        public MongoGridFsClient findIdsAndForget​(io.vertx.core.json.JsonObject query)
        Variant of findIds(JsonObject) that ignores the result of the operation.

        This method subscribes on the result of findIds(JsonObject), but discards the outcome (item or failure). This method is useful to trigger the asynchronous operation from findIds(JsonObject) but you don't need to compose it with other operations.

        Parameters:
        query - a bson query expressed as json that will be used to match files
        Returns:
        the instance of MongoGridFsClient to chain method calls.
      • uploadByFileName

        public io.smallrye.mutiny.Uni<String> uploadByFileName​(org.reactivestreams.Publisher<Buffer> stream,
                                                               String fileName)
      • uploadByFileNameAndAwait

        public String uploadByFileNameAndAwait​(org.reactivestreams.Publisher<Buffer> stream,
                                               String fileName)
      • uploadByFileNameAndForget

        public MongoGridFsClient uploadByFileNameAndForget​(org.reactivestreams.Publisher<Buffer> stream,
                                                           String fileName)
      • uploadByFileNameWithOptions

        public io.smallrye.mutiny.Uni<String> uploadByFileNameWithOptions​(ReadStream<Buffer> stream,
                                                                          String fileName,
                                                                          io.vertx.ext.mongo.GridFsUploadOptions options)
      • uploadByFileNameWithOptionsAndAwait

        public String uploadByFileNameWithOptionsAndAwait​(ReadStream<Buffer> stream,
                                                          String fileName,
                                                          io.vertx.ext.mongo.GridFsUploadOptions options)
      • uploadByFileNameWithOptionsAndForget

        public MongoGridFsClient uploadByFileNameWithOptionsAndForget​(ReadStream<Buffer> stream,
                                                                      String fileName,
                                                                      io.vertx.ext.mongo.GridFsUploadOptions options)
      • uploadByFileNameWithOptions

        public io.smallrye.mutiny.Uni<String> uploadByFileNameWithOptions​(org.reactivestreams.Publisher<Buffer> stream,
                                                                          String fileName,
                                                                          io.vertx.ext.mongo.GridFsUploadOptions options)
      • uploadByFileNameWithOptionsAndAwait

        public String uploadByFileNameWithOptionsAndAwait​(org.reactivestreams.Publisher<Buffer> stream,
                                                          String fileName,
                                                          io.vertx.ext.mongo.GridFsUploadOptions options)
      • uploadByFileNameWithOptionsAndForget

        public MongoGridFsClient uploadByFileNameWithOptionsAndForget​(org.reactivestreams.Publisher<Buffer> stream,
                                                                      String fileName,
                                                                      io.vertx.ext.mongo.GridFsUploadOptions options)
      • uploadFile

        public io.smallrye.mutiny.Uni<String> uploadFile​(String fileName)
        Upload a file to gridfs

        Unlike the bare Vert.x variant, this method returns a Uni. Don't forget to subscribe on it to trigger the operation.

        Parameters:
        fileName - the name of the file to store in gridfs
        Returns:
        the uni firing the result of the operation when completed, or a failure if the operation failed.
      • uploadFileAndAwait

        public String uploadFileAndAwait​(String fileName)
        Blocking variant of uploadFile(String).

        This method waits for the completion of the underlying asynchronous operation. If the operation completes successfully, the result is returned, otherwise the failure is thrown (potentially wrapped in a RuntimeException).

        Parameters:
        fileName - the name of the file to store in gridfs
        Returns:
        the String instance produced by the operation.
      • uploadFileAndForget

        public MongoGridFsClient uploadFileAndForget​(String fileName)
        Variant of uploadFile(String) that ignores the result of the operation.

        This method subscribes on the result of uploadFile(String), but discards the outcome (item or failure). This method is useful to trigger the asynchronous operation from uploadFile(String) but you don't need to compose it with other operations.

        Parameters:
        fileName - the name of the file to store in gridfs
        Returns:
        the instance of MongoGridFsClient to chain method calls.
      • uploadFileWithOptions

        public io.smallrye.mutiny.Uni<String> uploadFileWithOptions​(String fileName,
                                                                    io.vertx.ext.mongo.GridFsUploadOptions options)
        Upload a file to gridfs with options

        Unlike the bare Vert.x variant, this method returns a Uni. Don't forget to subscribe on it to trigger the operation.

        Parameters:
        fileName - the name of the file to store in gridfs
        options - GridFsUploadOptions for specifying metadata and chunk size
        Returns:
        the uni firing the result of the operation when completed, or a failure if the operation failed.
      • uploadFileWithOptionsAndAwait

        public String uploadFileWithOptionsAndAwait​(String fileName,
                                                    io.vertx.ext.mongo.GridFsUploadOptions options)
        Blocking variant of uploadFileWithOptions(String,GridFsUploadOptions).

        This method waits for the completion of the underlying asynchronous operation. If the operation completes successfully, the result is returned, otherwise the failure is thrown (potentially wrapped in a RuntimeException).

        Parameters:
        fileName - the name of the file to store in gridfs
        options - GridFsUploadOptions for specifying metadata and chunk size
        Returns:
        the String instance produced by the operation.
      • close

        public void close()
      • newInstance

        public static MongoGridFsClient newInstance​(io.vertx.ext.mongo.MongoGridFsClient arg)