mirror of
https://github.com/meilisearch/MeiliSearch
synced 2025-01-12 22:37:29 +01:00
update the macro to look more like an enum
This commit is contained in:
parent
786b0fabea
commit
1f54dfa883
@ -56,11 +56,11 @@ impl ProcessingTasks {
|
|||||||
}
|
}
|
||||||
|
|
||||||
macro_rules! make_enum_progress {
|
macro_rules! make_enum_progress {
|
||||||
(enum $name:ident: $(- $variant:ident)+ ) => {
|
($visibility:vis enum $name:ident { $($variant:ident,)+ }) => {
|
||||||
#[repr(u8)]
|
#[repr(u8)]
|
||||||
#[derive(Debug, Clone, Copy, PartialEq, Eq, Sequence)]
|
#[derive(Debug, Clone, Copy, PartialEq, Eq, Sequence)]
|
||||||
#[allow(clippy::enum_variant_names)]
|
#[allow(clippy::enum_variant_names)]
|
||||||
pub enum $name {
|
$visibility enum $name {
|
||||||
$($variant),+
|
$($variant),+
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -100,98 +100,112 @@ macro_rules! make_atomic_progress {
|
|||||||
}
|
}
|
||||||
|
|
||||||
make_enum_progress! {
|
make_enum_progress! {
|
||||||
enum BatchProgress:
|
pub enum BatchProgress {
|
||||||
- ProcessingTasks
|
ProcessingTasks,
|
||||||
- WritingTasksToDisk
|
WritingTasksToDisk,
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
make_enum_progress! {
|
make_enum_progress! {
|
||||||
enum TaskCancelationProgress:
|
pub enum TaskCancelationProgress {
|
||||||
- RetrievingTasks
|
RetrievingTasks,
|
||||||
- UpdatingTasks
|
UpdatingTasks,
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
make_enum_progress! {
|
make_enum_progress! {
|
||||||
enum TaskDeletionProgress:
|
pub enum TaskDeletionProgress {
|
||||||
- DeletingTasksDateTime
|
DeletingTasksDateTime,
|
||||||
- DeletingTasksMetadata
|
DeletingTasksMetadata,
|
||||||
- DeletingTasks
|
DeletingTasks,
|
||||||
- DeletingBatches
|
DeletingBatches,
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
make_enum_progress! {
|
make_enum_progress! {
|
||||||
enum SnapshotCreationProgress:
|
pub enum SnapshotCreationProgress {
|
||||||
- StartTheSnapshotCreation
|
StartTheSnapshotCreation,
|
||||||
- SnapshotTheIndexScheduler
|
SnapshotTheIndexScheduler,
|
||||||
- SnapshotTheUpdateFiles
|
SnapshotTheUpdateFiles,
|
||||||
- SnapshotTheIndexes
|
SnapshotTheIndexes,
|
||||||
- SnapshotTheApiKeys
|
SnapshotTheApiKeys,
|
||||||
- CreateTheTarball
|
CreateTheTarball,
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
make_enum_progress! {
|
make_enum_progress! {
|
||||||
enum DumpCreationProgress:
|
pub enum DumpCreationProgress {
|
||||||
- StartTheDumpCreation
|
StartTheDumpCreation,
|
||||||
- DumpTheApiKeys
|
DumpTheApiKeys,
|
||||||
- DumpTheTasks
|
DumpTheTasks,
|
||||||
- DumpTheIndexes
|
DumpTheIndexes,
|
||||||
- DumpTheExperimentalFeatures
|
DumpTheExperimentalFeatures,
|
||||||
- CompressTheDump
|
CompressTheDump,
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
make_enum_progress! {
|
make_enum_progress! {
|
||||||
enum CreateIndexProgress:
|
pub enum CreateIndexProgress {
|
||||||
- CreatingTheIndex
|
CreatingTheIndex,
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
make_enum_progress! {
|
make_enum_progress! {
|
||||||
enum UpdateIndexProgress:
|
pub enum UpdateIndexProgress {
|
||||||
- UpdatingTheIndex
|
UpdatingTheIndex,
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
make_enum_progress! {
|
make_enum_progress! {
|
||||||
enum DeleteIndexProgress:
|
pub enum DeleteIndexProgress {
|
||||||
- DeletingTheIndex
|
DeletingTheIndex,
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
make_enum_progress! {
|
make_enum_progress! {
|
||||||
enum SwappingTheIndexes:
|
pub enum SwappingTheIndexes {
|
||||||
- EnsuringCorrectnessOfTheSwap
|
EnsuringCorrectnessOfTheSwap,
|
||||||
- SwappingTheIndexes
|
SwappingTheIndexes,
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
make_enum_progress! {
|
make_enum_progress! {
|
||||||
enum InnerSwappingTwoIndexes:
|
pub enum InnerSwappingTwoIndexes {
|
||||||
- RetrieveTheTasks
|
RetrieveTheTasks,
|
||||||
- UpdateTheTasks
|
UpdateTheTasks,
|
||||||
- UpdateTheIndexesMetadata
|
UpdateTheIndexesMetadata,
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
make_enum_progress! {
|
make_enum_progress! {
|
||||||
enum DocumentOperationProgress:
|
pub enum DocumentOperationProgress {
|
||||||
- RetrievingConfig
|
RetrievingConfig,
|
||||||
- ComputingTheChanges
|
ComputingTheChanges,
|
||||||
- Indexing
|
Indexing,
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
make_enum_progress! {
|
make_enum_progress! {
|
||||||
enum DocumentEditionProgress:
|
pub enum DocumentEditionProgress {
|
||||||
- RetrievingConfig
|
RetrievingConfig,
|
||||||
- ComputingTheChanges
|
ComputingTheChanges,
|
||||||
- Indexing
|
Indexing,
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
make_enum_progress! {
|
make_enum_progress! {
|
||||||
enum DocumentDeletionProgress:
|
pub enum DocumentDeletionProgress {
|
||||||
- RetrievingConfig
|
RetrievingConfig,
|
||||||
- DeleteDocuments
|
DeleteDocuments,
|
||||||
- Indexing
|
Indexing,
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
make_enum_progress! {
|
make_enum_progress! {
|
||||||
enum SettingsProgress:
|
pub enum SettingsProgress {
|
||||||
- RetrievingAndMergingTheSettings
|
RetrievingAndMergingTheSettings,
|
||||||
- ApplyTheSettings
|
ApplyTheSettings,
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
make_atomic_progress!(Task alias AtomicTaskStep => "task" );
|
make_atomic_progress!(Task alias AtomicTaskStep => "task" );
|
||||||
|
Loading…
x
Reference in New Issue
Block a user