All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.google.cloud.storage.spi.RpcBatch Maven / Gradle / Ivy

The newest version!
/*
 * Copyright 2016 Google Inc. All Rights Reserved.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *       http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package com.google.cloud.storage.spi;

import com.google.api.client.googleapis.json.GoogleJsonError;
import com.google.api.services.storage.model.StorageObject;

import java.util.Map;

/**
 * An interface for the collection of batch operations.
 */
public interface RpcBatch {

  /**
   * An interface for batch callbacks.
   */
  interface Callback {

    /**
     * This method will be called upon success of the batch operation.
     */
    void onSuccess(T response);

    /**
     * This method will be called upon failure of the batch operation.
     */
    void onFailure(GoogleJsonError googleJsonError);
  }

  /**
   * Adds a call to "delete storage object" to the batch, with the provided {@code callback} and
   * {@code options}.
   */
  void addDelete(StorageObject storageObject, Callback callback,
      Map options);

  /**
   * Adds a call to "patch storage object" to the batch, with the provided {@code callback} and
   * {@code options}.
   */
  void addPatch(StorageObject storageObject, Callback callback,
      Map options);

  /**
   * Adds a call to "get storage object" to the batch, with the provided {@code callback} and
   * {@code options}.
   */
  void addGet(StorageObject storageObject, Callback callback,
      Map options);

  /**
   * Submits a batch of requests for processing using a single RPC request to Cloud Storage.
   */
  void submit();
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy