Class BigtableMethods


  • public final class BigtableMethods
    extends Object
    • Constructor Detail

      • BigtableMethods

        @Autowired
        public BigtableMethods​(io.toro.martini.database.DataSourceManager dataSourceManager,
                               io.toro.martini.gloop.converter.impl.GCRuleConverter grConverter,
                               io.toro.martini.gloop.converter.impl.FilterConverter filterConv)
    • Method Detail

      • createTable

        @GloopObjectParameter("output{\ntable#io.toro.martini.bigtable.Table{\n}\n}")
        public static GloopModel createTable​(@NotNull
                                             @NotNull String connectionName,
                                             String tableId,
                                             String familyId)
        Create new table that only required input is the family column id
        Parameters:
        connectionName - - The name of bigtable connection registered in Martini Runtime
        tableId - - The id of the table
        familyId - - The id of the family
        Returns:
        GloopModel describe the created table
      • createTable

        @GloopObjectParameter("output{\ntable#io.toro.martini.bigtable.Table{\n}\n}")
        public static GloopModel createTable​(@NotNull
                                             @NotNull String connectionName,
                                             String tableId,
                                             String familyId,
                                             String splitKey,
                                             @GloopObjectParameter("gcRule#io.toro.martini.bigtable.GCRule{\n}")
                                             GloopModel gcRule)
        Create new table and configure the GCRule of the table
        Parameters:
        connectionName - - The name of bigtable connection registered in Martini Runtime
        tableId - - The id of the table
        familyId - - The id of the family
        gcRule - - Describe the GCRule object which contain the DurationRule, VersionRule, IntersectionRule, UnionRule
        Returns:
        GloopModel describe the created table
      • createTable

        @GloopObjectParameter("output{\ntable#io.toro.martini.bigtable.Table{\n}\n}")
        public static GloopModel createTable​(@NotNull
                                             @NotNull String connectionName,
                                             String tableId,
                                             @GloopObjectParameter("mapGCRule#io.toro.martini.bigtable.MapGCRule[]{\n}")
                                             List<GloopModel> familyIds,
                                             List<String> splitKey)
        Create new table with multiple family columns id and split keys
        Parameters:
        connectionName - - The name of bigtable connection registered in Martini Runtime
        tableId - - The id of the table
        familyIds - - Configure the name of column family id with GCRule
        Returns:
        GloopModel
      • getTable

        @GloopObjectParameter("output{\ntable#io.toro.martini.bigtable.Table{\n}\n}")
        public static GloopModel getTable​(@NotNull
                                          @NotNull String connectionName,
                                          String tableId)
        Get the details of bigtable table using the tableId
        Parameters:
        connectionName - - The name of bigtable connection registered in Martini Runtime
        tableId - - The id of the table
        Returns:
        GloopModel
      • dropRowRange

        public static void dropRowRange​(@NotNull
                                        @NotNull String connectionName,
                                        String tableId,
                                        String rowKeyPrefix)
        Drops rows by the specified row key prefix and table ID.
        Parameters:
        connectionName - - The name of bigtable connection registered in Martini Runtime
        tableId - - The id of the table
        rowKeyPrefix - - Specify the row key to be dropped
      • dropAllRows

        public static void dropAllRows​(@NotNull
                                       @NotNull String connectionName,
                                       String tableId)
        Drops all data in the table.
        Parameters:
        connectionName - - The name of bigtable connection registered in Martini Runtime
        tableId - - Specify the table id to be dropped
      • awaitReplication

        public static void awaitReplication​(@NotNull
                                            @NotNull String connectionName,
                                            String tableId)
        Blocks the current thread until replication has caught up to the point when this method was called. This allows callers to make sure that their mutations have been replicated across all of their clusters.
        Parameters:
        connectionName - - The name of bigtable connection registered in Martini Runtime
        tableId - - The name of the table
      • deleteTable

        public static boolean deleteTable​(@NotNull
                                          @NotNull String connectionName,
                                          String tableId)
                                   throws IOException
        Deletes the table specified by the table ID.
        Parameters:
        connectionName - - The name of bigtable connection registered in Martini Runtime
        tableId - - Specify the table id to be deleted
        Returns:
        boolean
        Throws:
        IOException
      • listTables

        public static List<String> listTables​(@NotNull
                                              @NotNull String connectionName)
        List all tables in a Cloud Bigtable instance
        Parameters:
        connectionName - - The name of bigtable connection registered in Martini Runtime
        Returns:
        List
      • dropFamily

        @GloopObjectParameter("output{\ntable#io.toro.martini.bigtable.Table{\n}\n}")
        public static GloopModel dropFamily​(@NotNull
                                            @NotNull String connectionName,
                                            String tableId,
                                            String familyId)
                                     throws IOException
        Drops the specified ColumnFamily Sample Code
             BigtableMethods.dropFamily( "bigtableDb", "products", "cf1' );
         
        Parameters:
        connectionName - - The name of the bigtable connection registered in Martini Runtime
        tableId - - The id of the table where the familyId is located
        familyId - - Specify the family id to be dropped
        Returns:
        GloopModel
        Throws:
        IOException
      • dropFamily

        @GloopObjectParameter("output{\ntable#io.toro.martini.bigtable.Table{\n}\n}")
        public static GloopModel dropFamily​(@NotNull
                                            @NotNull String connectionName,
                                            String tableId,
                                            List<String> familyId)
                                     throws IOException
        Drop list of the specified column families Sample Code
             BigtableMethods.dropFamily( "bigtableDb", "products", "cf1' );
         
        Parameters:
        connectionName - - The name of the bigtable connection registered in Martini Runtime
        tableId - - The id of the table where the familyIds is located
        familyId - - Specify the list of family ids to be dropped
        Returns:
        GloopModel
        Throws:
        IOException
      • updateFamily

        @GloopObjectParameter("output{\ntable#io.toro.martini.bigtable.Table{\n}\n}")
        public static GloopModel updateFamily​(@NotNull
                                              @NotNull String connectionName,
                                              String tableId,
                                              String familyId,
                                              @GloopObjectParameter("gcRule#io.toro.martini.bigtable.GCRule{\n}")
                                              GloopModel gcRule)
        Updates the GCRules.GCRule of existing ColumnFamily
        Parameters:
        connectionName - - The name of the bigtable connection registered in Martini Runtime
        tableId - - The id of the table
        familyId - - The id of the column family
        gcRule - - Configure the GCRule of the column family
        Returns:
        GloopModel
      • updateFamily

        @GloopObjectParameter("output{\ntable#io.toro.martini.bigtable.Table{\n}\n}")
        public static GloopModel updateFamily​(@NotNull
                                              @NotNull String connectionName,
                                              String tableId,
                                              @GloopObjectParameter("mapGCRule#io.toro.martini.bigtable.MapGCRule[]{\n}")
                                              List<GloopModel> updateFamilies)
        Updates multiple GCRules.GCRule of existing ColumnFamilies
        Parameters:
        connectionName - - The name of the bigtable connection registered in Martini Runtime
        tableId - - The id of the table
        updateFamilies - -
        Returns:
        GloopModel
      • addFamily

        @GloopObjectParameter("output{\ntable#io.toro.martini.bigtable.Table{\n}\n}")
        public static GloopModel addFamily​(@NotNull
                                           @NotNull String connectionName,
                                           String tableId,
                                           String familyId,
                                           @GloopObjectParameter("gcRule#io.toro.martini.bigtable.GCRule{\n}")
                                           GloopModel gcRule)
        Configures the name of the new ColumnFamily to be created
        Parameters:
        connectionName - - The name of the bigtable connection registered in Martini Runtime
        tableId - - The id of the table
        familyId - - The id of the column family
        gcRule - - Configure the GCRule of the column family
        Returns:
        GloopModel
      • addFamily

        @GloopObjectParameter("output{\ntable#io.toro.martini.bigtable.Table{\n}\n}")
        public static GloopModel addFamily​(@NotNull
                                           @NotNull String connectionName,
                                           String tableId,
                                           @GloopObjectParameter("mapGCRule#io.toro.martini.bigtable.MapGCRule[]{\n}")
                                           List<GloopModel> addFamilies)
        Configures the names of the new ColumnFamilies with GCRule to be created
        Parameters:
        connectionName - - The name of the bigtable connection registered in Martini Runtime
        tableId - - The id of the table
        addFamilies - - Specify the column family ids and the GCRules into Map object to be added
        Returns:
        GloopModel
      • exists

        public static boolean exists​(@NotNull
                                     @NotNull String connectionName,
                                     String tableId,
                                     String rowKey)
                              throws IOException
        Check if the given row key exists or not
        Parameters:
        connectionName - - The name of bigtable connection registered in Martini Runtime
        tableId - - The id of the table
        rowKey - - The name of the row to be checked if existed
        Returns:
        Boolean
        Throws:
        IOException
      • exists

        public static boolean exists​(@NotNull
                                     @NotNull String connectionName,
                                     String tableId)
                              throws IOException
        Check if the table already existed
        Parameters:
        connectionName - - The name of bigtable connection registered in Martini Runtime
        tableId - - The id of the table
        Returns:
        Boolean
        Throws:
        IOException
      • readRow

        @GloopObjectParameter("output{\nrow#io.toro.martini.bigtable.Row{\n}\n}")
        public static GloopModel readRow​(@NotNull
                                         @NotNull String connectionName,
                                         String tableId,
                                         String rowKey)
        Synchronously reading a single row
        Parameters:
        connectionName - - The name of bigtable connection registered in Martini Runtime
        tableId - - The id of the table
        rowKey - - The name of the row to be read
        Returns:
        GloopModel
      • readRow

        @GloopObjectParameter("output{\nrow#io.toro.martini.bigtable.Row{\n}\n}")
        public static GloopModel readRow​(@NotNull
                                         @NotNull String connectionName,
                                         String tableId,
                                         String rowKey,
                                         @GloopObjectParameter("condition#io.toro.martini.bigtable.Filter{\n}")
                                         GloopModel filterModel)
        Synchronously reading a single row and able to filter the row Sample code
             BigtableMethods.readRow( "[BIGTABLE DB]",
             "[TABLE]",
             "[ROW KEY]",
             FILTERS.chain().filter(FILTERS.qualifier().regex("prefix.*")
             .filter(FILTERS.limit().cellsPerRow(10) );
         
        Parameters:
        connectionName - - The name of bigtable connection registered in Martini Runtime
        tableId - - The id of the table
        rowKey - - The name of the row to be read
        filterModel - - Filter when reading the row
        Returns:
        GloopModel
      • readRows

        @GloopObjectParameter("bigtableReadRowCursor{\n  bigtableReadRowCursor[]*{\n  }\n}")
        public static GloopCursor readRows​(@NotNull
                                           @NotNull String connectionName,
                                           @NotNull
                                           @NotNull String tableId,
                                           String rowKey,
                                           String prefix,
                                           Map<String,​String> range,
                                           @GloopObjectParameter("condition#io.toro.martini.bigtable.Filter{\n}")
                                           GloopModel filterModel,
                                           @GloopParameter(defaultValue="10")
                                           long limit,
                                           GloopExecutionContext context)
        Synchronously streaming the results of a Query. Return a GloopCursor
        Parameters:
        connectionName - - The name of bigtable connection registered in Martini Runtime
        tableId - - Constructs a new Query object for the specified table id
        rowKey - - Adds a key to looked up
        range - - Adds a range to be looked up. Start – The beginning of the range (inclusive). Can be null to represent negative infinity. End – The end of the range (exclusive). Can be null to represent positive infinity.
        filterModel - - Sets the filter to apply to each row. Only one filter can be set at a time.
        Returns:
        GloopCursor
      • mutationRow

        public static void mutationRow​(@NotNull
                                       @NotNull String connectionName,
                                       @NotNull
                                       @NotNull String tableId,
                                       @NotNull
                                       @NotNull String keyName,
                                       @GloopObjectParameter("mutation#io.toro.martini.bigtable.Mutation[]{\n}")
                                       List<GloopModel> mutation)
        Construct a single row to be inserted to the table
        Parameters:
        connectionName - - The name of bigtable connection registered in Martini Runtime
        tableId - - The id of the table
        keyName - - The name of the row
        mutation - - Describe the sets of mutation as GloopModel to be applied to a single row
      • checkAndMutateRow

        public static boolean checkAndMutateRow​(@NotNull
                                                @NotNull String connectionName,
                                                String tableId,
                                                String rowKey,
                                                @GloopObjectParameter("condition#io.toro.martini.bigtable.Filter{\n}")
                                                GloopModel condition,
                                                @GloopObjectParameter("then#io.toro.martini.bigtable.Mutation{\n}")
                                                GloopModel then,
                                                @GloopObjectParameter("otherwise#io.toro.martini.bigtable.Mutation{\n}")
                                                GloopModel otherwise)
        Convenience method to synchronously mutate a row atomically based on the output of a filter.
        Parameters:
        connectionName - - The name of bigtable connection registered in Martini Runtime
        tableId - - The id of the table
        rowKey - - The name of the row
        condition - - The filter to be applied to the contents of the specified row
        then - - Adds changes to be atomically applied to the specified row if the condition yields at least one cell when applied to the row
        otherwise - - Adds changes to be atomically applied to the specified row if the condition does not yields any cells when applied to the row.
        Returns:
        boolean
      • readModifyWriteRow

        @GloopObjectParameter("output{\nrow#io.toro.martini.bigtable.Row{\n}\n}")
        public static GloopModel readModifyWriteRow​(@NotNull
                                                    @NotNull String connectionName,
                                                    String tableId,
                                                    String rowKey,
                                                    @GloopObjectParameter("readModifyWriteRow#io.toro.martini.bigtable.ReadModifyWriteRow{\n}")
                                                    GloopModel readModifyWriteRowRequest)
        Convenience method that synchronously modifies a row atomically on the server.
        Parameters:
        connectionName - - The name of bigtable connection registered in Martini Runtime
        tableId - - The id of the table
        rowKey - - The name of the row
        readModifyWriteRowRequest - - Describe the ReadModifyWriteRow object as GloopModel
        Returns:
        GloopModel