Skip to content

Commit 30057d8

Browse files
authored
Add old method signatures of SchemaLoader's load(), unload() and repairAll() for backward compatibility (#2760)
1 parent ff9a2e2 commit 30057d8

File tree

2 files changed

+819
-0
lines changed

2 files changed

+819
-0
lines changed

schema-loader/src/main/java/com/scalar/db/schemaloader/SchemaLoader.java

Lines changed: 211 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -453,6 +453,217 @@ private static void repairAll(
453453
}
454454
}
455455

456+
/**
457+
* Creates tables defined in the schema file. See {@link #load(Properties, Path, Map, boolean,
458+
* boolean)} for details.
459+
*
460+
* @param configProperties ScalarDB config properties.
461+
* @param schemaFilePath path to schema file.
462+
* @param options specific options for creating tables.
463+
* @param createCoordinatorTables create coordinator tables or not.
464+
* @throws SchemaLoaderException thrown when creating tables fails.
465+
*/
466+
public static void load(
467+
Properties configProperties,
468+
@Nullable Path schemaFilePath,
469+
Map<String, String> options,
470+
boolean createCoordinatorTables)
471+
throws SchemaLoaderException {
472+
load(configProperties, schemaFilePath, options, createCoordinatorTables, false);
473+
}
474+
475+
/**
476+
* Creates tables defined in the schema file. See {@link #load(Path, Path, Map, boolean, boolean)}
477+
* for details.
478+
*
479+
* @param configFilePath path to ScalarDB config file.
480+
* @param schemaFilePath path to schema file.
481+
* @param options specific options for creating tables.
482+
* @param createCoordinatorTables create coordinator tables or not.
483+
* @throws SchemaLoaderException thrown when creating tables fails.
484+
*/
485+
public static void load(
486+
Path configFilePath,
487+
@Nullable Path schemaFilePath,
488+
Map<String, String> options,
489+
boolean createCoordinatorTables)
490+
throws SchemaLoaderException {
491+
load(configFilePath, schemaFilePath, options, createCoordinatorTables, false);
492+
}
493+
494+
/**
495+
* Creates tables defined in the schema. See {@link #load(Properties, String, Map, boolean,
496+
* boolean)} for details.
497+
*
498+
* @param configProperties ScalarDB config properties.
499+
* @param serializedSchemaJson serialized json string schema.
500+
* @param options specific options for creating tables.
501+
* @param createCoordinatorTables create coordinator tables or not.
502+
* @throws SchemaLoaderException thrown when creating tables fails.
503+
*/
504+
public static void load(
505+
Properties configProperties,
506+
@Nullable String serializedSchemaJson,
507+
Map<String, String> options,
508+
boolean createCoordinatorTables)
509+
throws SchemaLoaderException {
510+
load(configProperties, serializedSchemaJson, options, createCoordinatorTables, false);
511+
}
512+
513+
/**
514+
* Creates tables defined in the schema. See {@link #load(Path, String, Map, boolean, boolean)}
515+
* for details.
516+
*
517+
* @param configFilePath path to ScalarDB config file.
518+
* @param serializedSchemaJson serialized json string schema.
519+
* @param options specific options for creating tables.
520+
* @param createCoordinatorTables create coordinator tables or not.
521+
* @throws SchemaLoaderException thrown when creating tables fails.
522+
*/
523+
public static void load(
524+
Path configFilePath,
525+
@Nullable String serializedSchemaJson,
526+
Map<String, String> options,
527+
boolean createCoordinatorTables)
528+
throws SchemaLoaderException {
529+
load(configFilePath, serializedSchemaJson, options, createCoordinatorTables, false);
530+
}
531+
532+
/**
533+
* Delete tables defined in the schema file. See {@link #unload(Properties, Path, boolean,
534+
* boolean)} for details.
535+
*
536+
* @param configProperties ScalarDB config properties.
537+
* @param schemaFilePath path to schema file.
538+
* @param deleteCoordinatorTables delete coordinator tables or not.
539+
* @throws SchemaLoaderException thrown when deleting tables fails.
540+
*/
541+
public static void unload(
542+
Properties configProperties, @Nullable Path schemaFilePath, boolean deleteCoordinatorTables)
543+
throws SchemaLoaderException {
544+
unload(configProperties, schemaFilePath, deleteCoordinatorTables, false);
545+
}
546+
547+
/**
548+
* Delete tables defined in the schema file. See {@link #unload(Path, Path, boolean, boolean)} for
549+
* details.
550+
*
551+
* @param configFilePath path to ScalarDB config file.
552+
* @param schemaFilePath path to schema file.
553+
* @param deleteCoordinatorTables delete coordinator tables or not.
554+
* @throws SchemaLoaderException thrown when deleting tables fails.
555+
*/
556+
public static void unload(
557+
Path configFilePath, @Nullable Path schemaFilePath, boolean deleteCoordinatorTables)
558+
throws SchemaLoaderException {
559+
unload(configFilePath, schemaFilePath, deleteCoordinatorTables, false);
560+
}
561+
562+
/**
563+
* Delete tables defined in the schema. See {@link #unload(Properties, String, boolean, boolean)}
564+
* for details.
565+
*
566+
* @param configProperties ScalarDB config properties.
567+
* @param serializedSchemaJson serialized json string schema.
568+
* @param deleteCoordinatorTables delete coordinator tables or not.
569+
* @throws SchemaLoaderException thrown when deleting tables fails.
570+
*/
571+
public static void unload(
572+
Properties configProperties,
573+
@Nullable String serializedSchemaJson,
574+
boolean deleteCoordinatorTables)
575+
throws SchemaLoaderException {
576+
unload(configProperties, serializedSchemaJson, deleteCoordinatorTables, false);
577+
}
578+
579+
/**
580+
* Delete tables defined in the schema. See {@link #unload(Path, String, boolean, boolean)} for
581+
* details.
582+
*
583+
* @param configFilePath path to ScalarDB config file.
584+
* @param serializedSchemaJson serialized json string schema.
585+
* @param deleteCoordinatorTables delete coordinator tables or not.
586+
* @throws SchemaLoaderException thrown when deleting tables fails.
587+
*/
588+
public static void unload(
589+
Path configFilePath, @Nullable String serializedSchemaJson, boolean deleteCoordinatorTables)
590+
throws SchemaLoaderException {
591+
unload(configFilePath, serializedSchemaJson, deleteCoordinatorTables, false);
592+
}
593+
594+
/**
595+
* Repair namespaces and tables. See {@link #repairAll(Properties, String, Map, boolean, boolean)}
596+
* for details.
597+
*
598+
* @param configProperties ScalarDB config properties
599+
* @param serializedSchemaJson serialized json string schema.
600+
* @param options specific options for repairing.
601+
* @param repairCoordinatorTable repair coordinator tables or not.
602+
* @throws SchemaLoaderException thrown when repairing fails.
603+
*/
604+
public static void repairAll(
605+
Properties configProperties,
606+
String serializedSchemaJson,
607+
Map<String, String> options,
608+
boolean repairCoordinatorTable)
609+
throws SchemaLoaderException {
610+
repairAll(configProperties, serializedSchemaJson, options, repairCoordinatorTable, false);
611+
}
612+
613+
/**
614+
* Repair namespaces and tables. See {@link #repairAll(Path, String, Map, boolean, boolean)} for
615+
* details.
616+
*
617+
* @param configProperties ScalarDB properties.
618+
* @param schemaPath path to the schema file.
619+
* @param options specific options for repairing.
620+
* @param repairCoordinatorTable repair coordinator tables or not.
621+
* @throws SchemaLoaderException thrown when repairing fails.
622+
*/
623+
public static void repairAll(
624+
Properties configProperties,
625+
Path schemaPath,
626+
Map<String, String> options,
627+
boolean repairCoordinatorTable)
628+
throws SchemaLoaderException {
629+
repairAll(configProperties, schemaPath, options, repairCoordinatorTable, false);
630+
}
631+
632+
/**
633+
* Repair namespaces and tables. See {@link #repairAll(Path, String, Map, boolean, boolean)} for
634+
* details.
635+
*
636+
* @param configPath path to the ScalarDB config.
637+
* @param serializedSchemaJson serialized json string schema.
638+
* @param options specific options for repairing.
639+
* @param repairCoordinatorTable repair coordinator tables or not.
640+
* @throws SchemaLoaderException thrown when repairing fails.
641+
*/
642+
public static void repairAll(
643+
Path configPath,
644+
String serializedSchemaJson,
645+
Map<String, String> options,
646+
boolean repairCoordinatorTable)
647+
throws SchemaLoaderException {
648+
repairAll(configPath, serializedSchemaJson, options, repairCoordinatorTable, false);
649+
}
650+
651+
/**
652+
* Repair namespaces and tables. See {@link #repairAll(Path, Path, Map, boolean, boolean)} for
653+
* details.
654+
*
655+
* @param configPath path to the ScalarDB config.
656+
* @param schemaPath path to the schema file.
657+
* @param options specific options for repairing.
658+
* @param repairCoordinatorTable repair coordinator tables or not.
659+
* @throws SchemaLoaderException thrown when repairing fails.
660+
*/
661+
public static void repairAll(
662+
Path configPath, Path schemaPath, Map<String, String> options, boolean repairCoordinatorTable)
663+
throws SchemaLoaderException {
664+
repairAll(configPath, schemaPath, options, repairCoordinatorTable, false);
665+
}
666+
456667
/**
457668
* Alter the tables defined in the schema. Supported alter operations are:
458669
*

0 commit comments

Comments
 (0)