org.apache.tinkerpop.gremlin.structure.io

## Interface Storage

- All Known Implementing Classes:
    FileSystemStorage, SparkContextStorage

      public interface Storage

  Storage is a standard API that providers can implement to allow abstract UNIX-like file system for data sources. The methods provided by Storage are similar in form and behavior to standard Linux operating system commands.
  - A name pattern (file or directory) is a sequence of characters, not containing "/", leading spaces, trailing spaces.
  - A name (file or directory name) is a name pattern, not containing "*" or "?".
  - A pattern is a sequence of names separated with "/", optionally ending at a name pattern.

           <pattern> ::= <absolute pattern> |
                         <relative pattern>
           <absolute path> ::= / [<relative pattern>]
           <relative path> ::= <name> {/ <name>} [/ <name pattern>] [/] |
                               <name pattern> [/]

  - A path is a path is a pattern, not containing any name pattern.
  NOTE:
  1. Even though the syntax allows patterns with trailing "/", they are treated as referring the same file or directory as the path without the trailing /
  2. This is an abstract file system abstracting the underlying physical file system if any. Thus, under Windows the directories separator is still /, no matter that Windows uses \
  Author:
    Marko A. Rodriguez (http://markorodriguez.com)

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `static String` | `FILE_SEPARATOR` The file and directory names separator in this uniform UNIX-like abstract file system
    `static String` | `ROOT_DIRECTORY`

  - ### Method Summary

    All Methods Static Methods Instance Methods Abstract Methods Default Methods
    Modifier and Type | Method and Description
    --- | ---
    `boolean` | `cp(String sourcePattern, String targetDirectory)` Recursively copy all the data sources from the source location to the target location.
    `boolean` | `exists(String pattern)` Determine whether the specified location has a data source.
    `default Iterator<String>` | `head(String location)` Get a string representation of the specified number of lines at the data source location.
    `default Iterator<Vertex>` | `head(String location, Class readerClass)` Get the vertices at the specified graph location.
    `Iterator<Vertex>` | `head(String location, Class readerClass, int totalLines)` Get the vertices at the specified graph location.
    `Iterator<String>` | `head(String location, int totalLines)` Get a string representation of the specified number of lines at the data source location.
    `default <K,V> Iterator<KeyValue<K,V>>` | `head(String location, String memoryKey, Class readerClass)` Get the `KeyValue` data at the specified memory location.
    `<K,V> Iterator<KeyValue<K,V>>` | `head(String location, String memoryKey, Class readerClass, int totalLines)` Get the `KeyValue` data at the specified memory location.
    `List<String>` | `ls()` List all the data sources in the root directory.
    `List<String>` | `ls(String pattern)` List all the files (e.g.
    `boolean` | `rm(String pattern)` Recursively remove the file (data source) at the specified location.
    `static String` | `toPath(File path)`
    `static String` | `toPath(String path)`

- - ### Field Detail

    - #### FILE_SEPARATOR

          static final String FILE_SEPARATOR

      The file and directory names separator in this uniform UNIX-like abstract file system
      See Also:
        Constant Field Values

    - #### ROOT_DIRECTORY

          static final String ROOT_DIRECTORY

      See Also:
        Constant Field Values

  - ### Method Detail

    - #### ls

          List<String> ls()

      List all the data sources in the root directory.
      Returns:
        non-null list of files (data sources) and directories in the root directory (/)
      See Also:
        `ls(String)`

    - #### ls

          List<String> ls(String pattern)

      List all the files (e.g. data sources) and directories matching the location pattern.
      Parameters:
        `pattern` - non-null pattern specifying a set of files and directories. Cases:
        - a path to a file - specifies a single file to list
        - a path to a directory - specifies all files and directories immediately nested in that directory to list
        - pattern - specifies a set of files and directories to list
        - / - specifies the root directory to list its contents
      Returns:
        non-null list of files (data sources) and directories matching the pattern.

    - #### cp

          boolean cp(String sourcePattern,
                     String targetDirectory)

      Recursively copy all the data sources from the source location to the target location.
      Parameters:
        `sourcePattern` - non-null pattern specifying a set of files and directories. Cases:
        - a path to a file - specifies a single file
        - a path to a directory - specifies all files and directories nested (recursively) in that directory
        - pattern - specifies a set of files and directories
        - / - specifies the contents of the root directory (recursively)
        `targetDirectory` - non-null directory where to copy to
      Returns:
        whether data sources were copied

    - #### exists

          boolean exists(String pattern)

      Determine whether the specified location has a data source.
      Parameters:
        `pattern` - non-null pattern specifying a set of files and directories. Examples:
        - a path to a file - specifies a single file
        - a path to a directory - specifies the contents of that directory as all files and directories immediately nested in it
        - pattern - specifies a set of files and directories
        - / - specifies the immediate contents of the root directory
      Returns:
        true if the pattern specifies a non-empty set of files and directories

    - #### rm

          boolean rm(String pattern)

      Recursively remove the file (data source) at the specified location. NOTE: Some implementations derive the notion of the containing directory from the presence of the file, so removing all files from a directory in those implementations removes also their directory.
      Parameters:
        `pattern` - non-null pattern specifying a set of files and directories. Examples:
        - a path to a file - specifies a single file
        - a path to a directory - specifies that directory and all files and directories recursively nested in it
        - pattern - specifies a set of files and directories
        - / - specifies the root directory
      Returns:
        true if all specified files and directories were removed

    - #### head

          default Iterator<String> head(String location)

      Get a string representation of the specified number of lines at the data source location.
      Parameters:
        `location` - the data source location
      Returns:
        an iterator of lines

    - #### head

          Iterator<String> head(String location,
                                int totalLines)

      Get a string representation of the specified number of lines at the data source location.
      Parameters:
        `location` - the data source location
        `totalLines` - the total number of lines to retrieve
      Returns:
        an iterator of lines.

    - #### head

          Iterator<Vertex> head(String location,
                                Class readerClass,
                                int totalLines)

      Get the vertices at the specified graph location.
      Parameters:
        `location` - the location of the graph (or the root location and search will be made)
        `readerClass` - the class of the parser that understands the graph format
        `totalLines` - the total number of lines of the graph to return
      Returns:
        an iterator of vertices.

    - #### head

          default Iterator<Vertex> head(String location,
                                        Class readerClass)

      Get the vertices at the specified graph location.
      Parameters:
        `location` - the location of the graph (or the root location and search will be made)
        `readerClass` - the class of the parser that understands the graph format
      Returns:
        an iterator of vertices.

    - #### head

          <K,V> Iterator<KeyValue<K,V>> head(String location,
                                             String memoryKey,
                                             Class readerClass,
                                             int totalLines)

      Get the `KeyValue` data at the specified memory location.
      Parameters:
        `location` - the root location of the data
        `memoryKey` - the memory key
        `readerClass` - the class of the parser that understands the memory format
        `totalLines` - the total number of key-values to return
      Returns:
        an iterator of key-values.

    - #### head

          default <K,V> Iterator<KeyValue<K,V>> head(String location,
                                                     String memoryKey,
                                                     Class readerClass)

      Get the `KeyValue` data at the specified memory location.
      Parameters:
        `location` - the root location of the data
        `memoryKey` - the memory key
        `readerClass` - the class of the parser that understands the memory format
      Returns:
        an iterator of key-values.

    - #### toPath

          static String toPath(File path)

      Parameters:
        `path` - non-null local file path
      Returns:
        non-null, not empty path in the `Storage` file system.

    - #### toPath

          static String toPath(String path)

      Parameters:
        `path` - non-null local file path
      Returns:
        non-null, not empty path in the `Storage` file system.

Copyright © 2013–2021 Apache Software Foundation. All rights reserved.