mirror of
https://github.com/meilisearch/MeiliSearch
synced 2024-11-23 13:24:27 +01:00
Fix some 'all' flags making problems
This commit is contained in:
parent
544961372c
commit
b89fd49d63
@ -405,11 +405,11 @@ impl From<v5::Action> for v6::Action {
|
||||
v5::Action::SettingsAll => v6::Action::SettingsAll,
|
||||
v5::Action::SettingsGet => v6::Action::SettingsGet,
|
||||
v5::Action::SettingsUpdate => v6::Action::SettingsUpdate,
|
||||
v5::Action::StatsAll => v6::Action::StatsAll,
|
||||
v5::Action::StatsAll => v6::Action::StatsGet,
|
||||
v5::Action::StatsGet => v6::Action::StatsGet,
|
||||
v5::Action::MetricsAll => v6::Action::MetricsAll,
|
||||
v5::Action::MetricsAll => v6::Action::MetricsGet,
|
||||
v5::Action::MetricsGet => v6::Action::MetricsGet,
|
||||
v5::Action::DumpsAll => v6::Action::DumpsAll,
|
||||
v5::Action::DumpsAll => v6::Action::DumpsCreate,
|
||||
v5::Action::DumpsCreate => v6::Action::DumpsCreate,
|
||||
v5::Action::Version => v6::Action::Version,
|
||||
v5::Action::KeysAdd => v6::Action::KeysAdd,
|
||||
|
@ -128,21 +128,9 @@ impl HeedAuthStore {
|
||||
Action::SettingsAll => {
|
||||
actions.extend([Action::SettingsGet, Action::SettingsUpdate].iter());
|
||||
}
|
||||
Action::DumpsAll => {
|
||||
actions.insert(Action::DumpsCreate);
|
||||
}
|
||||
Action::SnapshotsAll => {
|
||||
actions.insert(Action::SnapshotsCreate);
|
||||
}
|
||||
Action::TasksAll => {
|
||||
actions.extend([Action::TasksGet, Action::TasksDelete, Action::TasksCancel]);
|
||||
}
|
||||
Action::StatsAll => {
|
||||
actions.insert(Action::StatsGet);
|
||||
}
|
||||
Action::MetricsAll => {
|
||||
actions.insert(Action::MetricsGet);
|
||||
}
|
||||
other => {
|
||||
actions.insert(other);
|
||||
}
|
||||
@ -294,8 +282,8 @@ impl HeedAuthStore {
|
||||
pub struct KeyIdActionCodec;
|
||||
|
||||
impl KeyIdActionCodec {
|
||||
fn action_parts_to_repr([p1, p2, p3, p4]: &[u8; 4]) -> u32 {
|
||||
((p1 << 24) | (p2 << 16) | (p3 << 8) | p4) as u32
|
||||
fn action_parts_to_32bits([p1, p2, p3, p4]: &[u8; 4]) -> u32 {
|
||||
((*p1 as u32) << 24) | ((*p2 as u32) << 16) | ((*p3 as u32) << 8) | (*p4 as u32)
|
||||
}
|
||||
}
|
||||
|
||||
@ -306,8 +294,8 @@ impl<'a> milli::heed::BytesDecode<'a> for KeyIdActionCodec {
|
||||
let (key_id_bytes, action_bytes) = try_split_array_at(bytes).ok_or(SliceTooShortError)?;
|
||||
let (action_bits, index) =
|
||||
match try_split_array_at::<u8, 4>(action_bytes).ok_or(SliceTooShortError)? {
|
||||
(action_parts, []) => (Self::action_parts_to_repr(action_parts), None),
|
||||
(action_parts, index) => (Self::action_parts_to_repr(action_parts), Some(index)),
|
||||
(action_parts, []) => (Self::action_parts_to_32bits(action_parts), None),
|
||||
(action_parts, index) => (Self::action_parts_to_32bits(action_parts), Some(index)),
|
||||
};
|
||||
let key_id = Uuid::from_bytes(*key_id_bytes);
|
||||
let action = Action::from_bits(action_bits).ok_or(InvalidActionError { action_bits })?;
|
||||
|
@ -206,18 +206,10 @@ bitflags! {
|
||||
const SettingsGet = 1 << 12;
|
||||
const SettingsUpdate = 1 << 13;
|
||||
const SettingsAll = Self::SettingsGet.bits() | Self::SettingsUpdate.bits();
|
||||
// Stats
|
||||
const StatsGet = 1 << 14;
|
||||
const StatsAll = Self::StatsGet.bits();
|
||||
// Metrics
|
||||
const MetricsGet = 1 << 15;
|
||||
const MetricsAll = Self::MetricsGet.bits();
|
||||
// Dumps
|
||||
const DumpsCreate = 1 << 16;
|
||||
const DumpsAll = Self::DumpsCreate.bits();
|
||||
// Snapshots
|
||||
const SnapshotsCreate = 1 << 17;
|
||||
const SnapshotsAll = Self::SnapshotsCreate.bits();
|
||||
const Version = 1 << 18;
|
||||
const KeysAdd = 1 << 19;
|
||||
const KeysGet = 1 << 20;
|
||||
@ -240,7 +232,7 @@ bitflags! {
|
||||
}
|
||||
|
||||
impl Action {
|
||||
const SERDE_MAP_ARR: [(&'static str, Self); 34] = [
|
||||
const SERDE_MAP_ARR: [(&'static str, Self); 30] = [
|
||||
("search", Self::Search),
|
||||
("documents.add", Self::DocumentsAdd),
|
||||
("documents.get", Self::DocumentsGet),
|
||||
@ -260,13 +252,9 @@ impl Action {
|
||||
("settings.update", Self::SettingsUpdate),
|
||||
("settings.*", Self::SettingsAll),
|
||||
("stats.get", Self::StatsGet),
|
||||
("stats.*", Self::StatsAll),
|
||||
("metrics.get", Self::MetricsGet),
|
||||
("metrics.*", Self::MetricsAll),
|
||||
("dumps.create", Self::DumpsCreate),
|
||||
("dumps.*", Self::DumpsAll),
|
||||
("snapshots.create", Self::SnapshotsCreate),
|
||||
("snapshots.*", Self::SnapshotsAll),
|
||||
("version", Self::Version),
|
||||
("keys.create", Self::KeysAdd),
|
||||
("keys.get", Self::KeysGet),
|
||||
@ -315,11 +303,8 @@ pub mod actions {
|
||||
pub const SETTINGS_UPDATE: u32 = A::SettingsUpdate.bits();
|
||||
pub const SETTINGS_ALL: u32 = A::SettingsAll.bits();
|
||||
pub const STATS_GET: u32 = A::StatsGet.bits();
|
||||
pub const STATS_ALL: u32 = A::StatsAll.bits();
|
||||
pub const METRICS_GET: u32 = A::MetricsGet.bits();
|
||||
pub const METRICS_ALL: u32 = A::MetricsAll.bits();
|
||||
pub const DUMPS_CREATE: u32 = A::DumpsCreate.bits();
|
||||
pub const DUMPS_ALL: u32 = A::DumpsAll.bits();
|
||||
pub const SNAPSHOTS_CREATE: u32 = A::SnapshotsCreate.bits();
|
||||
pub const VERSION: u32 = A::Version.bits();
|
||||
pub const KEYS_CREATE: u32 = A::KeysAdd.bits();
|
||||
@ -411,7 +396,7 @@ impl Sequence for Action {
|
||||
}
|
||||
}
|
||||
|
||||
Non
|
||||
None
|
||||
}
|
||||
|
||||
fn previous(&self) -> Option<Self> {
|
||||
|
Loading…
Reference in New Issue
Block a user