Skip to content

Commit

Permalink
Fix doc
Browse files Browse the repository at this point in the history
  • Loading branch information
cindyyan317 committed Dec 3, 2024
1 parent 8cb7a4d commit ac06433
Show file tree
Hide file tree
Showing 7 changed files with 43 additions and 3 deletions.
10 changes: 10 additions & 0 deletions src/data/cassandra/Types.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -67,10 +67,20 @@ struct Limit {
struct Text {
std::string text;

/**
* @brief Construct a new Text object from string type
*
* @param text The text to wrap
*/
explicit Text(std::string text) : text{std::move(text)}
{
}

/**
* @brief Construct a new Text object from char const* type
*
* @param text The text to wrap
*/
explicit Text(char const* text) : text{text}
{
}
Expand Down
13 changes: 12 additions & 1 deletion src/migration/MigrationApplication.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -58,17 +58,27 @@ class MigratorApplication {

std::variant<Status, Migration, Rollback> state;

// Helper methods for convenience
/**
* @brief Helper function to create a status command
*/
static Cmd
status()
{
return Cmd{Status{}};
}

/**
* @brief Helper function to create a migration command
*/
static Cmd
migration(std::string const& name)
{
return Cmd{Migration{name}};
}

/**
* @brief Helper function to create a rollback command
*/
static Cmd
rollback(std::string const& name)
{
Expand All @@ -80,6 +90,7 @@ class MigratorApplication {
* @brief Construct a new MigratorApplication object
*
* @param config The configuration of the application
* @param command The command to run
*/
MigratorApplication(util::Config const& config, Cmd command);

Expand Down
5 changes: 5 additions & 0 deletions src/migration/MigrationManagerInterface.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -58,12 +58,17 @@ struct MigrationManagerInterface {

/**
* @brief Get all registered migrators' names
*
* @return A vector of migrators' names
*/
virtual std::vector<std::string>
allMigratorsNames() const = 0;

/**
* @brief Get the status of a migrator by its name
*
* @param name The migrator's name
* @return The status of the migrator
*/
virtual MigratorStatus
getMigratorStatusByName(std::string const& name) const = 0;
Expand Down
2 changes: 1 addition & 1 deletion src/migration/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ If you need to do full scan against other table, you can follow below steps:
- `PARTITION_KEY`, it's the name of the partition key of the table.
> **Note** The order of types should match what database will return in a row. Key types should come first, followed by other field types sorted in alphabetical order.
- `TABLE_NAME`

- Inherent from `FullTableScannerAdapterBase`.
- Implement `onRowRead`, its parameter is the `Row` we defined. It's the callback function when a row is read.

Expand Down
6 changes: 6 additions & 0 deletions src/migration/cassandra/FullTableScanner.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,12 @@ struct TokenRange {
std::int64_t start;
std::int64_t end;

/**
* @brief Construct a new Token Range object
*
* @param start The start token
* @param end The end token
*/
TokenRange(std::int64_t start, std::int64_t end) : start{start}, end{end}
{
}
Expand Down
8 changes: 7 additions & 1 deletion src/migration/cassandra/FullTableScannerAdapterBase.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,14 +40,20 @@ template <TableSpec TableDesc>
struct FullTableScannerAdapterBase {
static_assert(TableSpec<TableDesc>);

protected:
/**
* @brief The backend to use
*/
std::shared_ptr<CassandraMigrationBackend> backend_;

public:
virtual ~FullTableScannerAdapterBase() = default;

/**
* @brief Construct a new Full Table Scanner Adapter Base object
*
* @param backend The backend
*/
std::shared_ptr<CassandraMigrationBackend> backend_;
FullTableScannerAdapterBase(std::shared_ptr<CassandraMigrationBackend> backend) : backend_(std::move(backend))
{
}
Expand Down
2 changes: 2 additions & 0 deletions src/migration/cassandra/TransactionsAdapter.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,8 @@ class TransactionsAdapter : public FullTableScannerAdapterBase<TableTransactions

/**
*@brief The callback when a row is read.
*
*@param row The row to read
*/
void
onRowRead(TableTransactionsDesc::Row const& row) override;
Expand Down

0 comments on commit ac06433

Please sign in to comment.