Skip to content

Commit c1441b7

Browse files
committed
Add old method signatures of SchemaLoader's load(), unload() and repairAll() for backward compatibility (#2760)
1 parent 046a0f7 commit c1441b7

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
@@ -440,6 +440,217 @@ private static void repairTables(
440440
}
441441
}
442442

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

0 commit comments

Comments
 (0)