Github user redsanket commented on a diff in the pull request:

    https://github.com/apache/storm/pull/845#discussion_r45301462
  
    --- Diff: storm-core/src/jvm/backtype/storm/blobstore/BlobStore.java ---
    @@ -0,0 +1,446 @@
    +/**
    + * Licensed to the Apache Software Foundation (ASF) under one
    + * or more contributor license agreements.  See the NOTICE file
    + * distributed with this work for additional information
    + * regarding copyright ownership.  The ASF licenses this file
    + * to you 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 backtype.storm.blobstore;
    +
    +import java.io.ByteArrayOutputStream;
    +import java.io.IOException;
    +import java.io.InputStream;
    +import java.io.OutputStream;
    +import java.util.HashSet;
    +import java.util.Iterator;
    +import java.util.Map;
    +import java.util.NoSuchElementException;
    +import java.util.Set;
    +import java.util.regex.Pattern;
    +
    +import javax.security.auth.Subject;
    +
    +import backtype.storm.nimbus.NimbusInfo;
    +import org.slf4j.Logger;
    +import org.slf4j.LoggerFactory;
    +
    +import backtype.storm.daemon.Shutdownable;
    +import backtype.storm.generated.AuthorizationException;
    +import backtype.storm.generated.KeyNotFoundException;
    +import backtype.storm.generated.KeyAlreadyExistsException;
    +import backtype.storm.generated.ReadableBlobMeta;
    +import backtype.storm.generated.SettableBlobMeta;
    +
    +/**
    + * Provides a way to store blobs that can be downloaded.
    + * Blobs must be able to be uploaded and listed from Nimbus,
    + * and downloaded from the Supervisors. It is a key value based
    + * store. Key being a string and value being the blob data.
    + *
    + * ACL checking must take place against the provided subject.
    + * If the blob store does not support Security it must validate
    + * that all ACLs set are always WORLD, everything.
    + *
    + * The users can upload their blobs through the blob store command
    + * line utility. The command line utilty also allows us to update,
    + * delete.
    + *
    + * Modifying the replication factor only works for HdfsBlobStore
    + * as for the LocalFsBlobStore the replication is dependent on
    + * the number of Nimbodes available.
    + */
    +public abstract class BlobStore implements Shutdownable {
    +  public static final Logger LOG = 
LoggerFactory.getLogger(BlobStore.class);
    +  private static final Pattern KEY_PATTERN = Pattern.compile("^[\\w 
\\t\\.:_-]+$");
    +  protected static final String BASE_BLOBS_DIR_NAME = "blobs";
    +
    +  /**
    +   * Allows us to initialize the blob store
    +   * @param conf
    +   * @param baseDir
    +   */
    +  public abstract void prepare(Map conf, String baseDir, NimbusInfo 
nimbusInfo);
    +
    +  /**
    +   * Creates the blob.
    +   * @param key Key for the blob.
    +   * @param meta Metadata which contains the acls information
    +   * @param who Is the subject creating the blob.
    +   * @return AtomicOutputStream returns a stream into which the data
    +   * can be written into.
    +   * @throws AuthorizationException
    +   * @throws KeyAlreadyExistsException
    +   */
    +  public abstract AtomicOutputStream createBlob(String key, 
SettableBlobMeta meta, Subject who) throws AuthorizationException, 
KeyAlreadyExistsException;
    +
    +  /**
    +   * Updates the blob data.
    +   * @param key Key for the blob.
    +   * @param who Is the subject creating the blob.
    +   * @return AtomicOutputStream returns a stream into which the data
    +   * can be written into.
    +   * @throws AuthorizationException
    +   * @throws KeyNotFoundException
    +   */
    +  public abstract AtomicOutputStream updateBlob(String key, Subject who) 
throws AuthorizationException, KeyNotFoundException;
    +
    +  /**
    +   * Gets the current version of metadata for a blob
    +   * to be viewed by the user or downloaded by the supervisor.
    +   * @param key Key for the blob.
    +   * @param who Is the subject creating the blob.
    +   * @return AtomicOutputStream returns a stream into which the data
    +   * can be written into.
    +   * @throws AuthorizationException
    +   * @throws KeyNotFoundException
    +   */
    +  public abstract ReadableBlobMeta getBlobMeta(String key, Subject who) 
throws AuthorizationException, KeyNotFoundException;
    +
    +  /**
    +   * Sets the metadata with renewed acls for the blob.
    +   * @param key Key for the blob.
    +   * @param meta Metadata which contains the updated
    +   * acls information.
    +   * @param who Is the subject creating the blob.
    +   * @throws AuthorizationException
    +   * @throws KeyNotFoundException
    +   */
    +  public abstract void setBlobMeta(String key, SettableBlobMeta meta, 
Subject who) throws AuthorizationException, KeyNotFoundException;
    +
    +  /**
    +   * Deletes the blob data and metadata.
    +   * @param key Key for the blob.
    +   * @param who Is the subject creating the blob.
    +   * @throws AuthorizationException
    +   * @throws KeyNotFoundException
    +   */
    +  public abstract void deleteBlob(String key, Subject who) throws 
AuthorizationException, KeyNotFoundException;
    +
    +  /**
    +   * Gets the current version of metadata for a blob
    +   * to be viewed by the user or downloaded by the supervisor.
    +   * @param key Key for the blob.
    +   * @param who Is the subject creating the blob.
    +   * @return InputStreamWithMeta has the additional
    +   * file length and version information.
    +   * @throws AuthorizationException
    +   * @throws KeyNotFoundException
    +   */
    +  public abstract InputStreamWithMeta getBlob(String key, Subject who) 
throws AuthorizationException, KeyNotFoundException;
    +
    +  /**
    +   * Returns an iterator with all the list of
    +   * keys currently available on the blob store.
    +   * @param who Is the subject creating the blob.
    +   * @return Iterator<String>
    +   */
    +  public abstract Iterator<String> listKeys(Subject who);
    +
    +  /**
    +   * Gets the replication factor of the blob.
    +   * @param key Key for the blob.
    +   * @param who Is the subject creating the blob.
    +   * @return BlobReplication object containing the
    +   * replication factor for the blob.
    +   * @throws Exception
    +   */
    +  public abstract int getBlobReplication(String key, Subject who) throws 
Exception;
    --- End diff --
    
    Using a zookeeper call so it throws an Exception. As Exception encompasses 
AuthorizationException not throwing it


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

Reply via email to