Skip to content
GitLab
Explorer
Connexion
Navigation principale
Rechercher ou aller à…
Projet
lektor
Gestion
Activité
Membres
Labels
Programmation
Tickets
Tableaux des tickets
Jalons
Code
Requêtes de fusion
Dépôt
Branches
Validations
Étiquettes
Graphe du dépôt
Comparer les révisions
Compilation
Pipelines
Jobs
Planifications de pipeline
Artéfacts
Aide
Aide
Support
Documentation de GitLab
Comparer les forfaits GitLab
Forum de la communauté GitLab
Contribuer à GitLab
Donner votre avis
Raccourcis clavier
?
Extraits de code
Groupes
Projets
Afficher davantage de fils d'Ariane
Kubat
lektor
Validations
dd4a3927
Vérifiée
Valider
dd4a3927
rédigé
26 janv. 2023
par
Kubat
Parcourir les fichiers
Options
Téléchargements
Correctifs
Plain Diff
WIP: We will load and write patch files for the database with auxiliary types.
parent
47f14a3f
Branches
Branches contenant la validation
Aucune étiquette associée trouvée
Aucune requête de fusion associée trouvée
Modifications
2
Afficher les modifications d'espaces
En ligne
Côte à côte
Affichage de
2 fichiers modifiés
src/rust/amalib/src/db_cache.rs
+4
-3
4 ajouts, 3 suppressions
src/rust/amalib/src/db_cache.rs
src/rust/amalib/src/db_kara.rs
+30
-5
30 ajouts, 5 suppressions
src/rust/amalib/src/db_kara.rs
avec
34 ajouts
et
8 suppressions
src/rust/amalib/src/db_cache.rs
+
4
−
3
Voir le fichier @
dd4a3927
...
@@ -9,17 +9,15 @@ use lru::LruCache;
...
@@ -9,17 +9,15 @@ use lru::LruCache;
/// cache, if its the playlists that are updated, we clear only the playlist, if
/// cache, if its the playlists that are updated, we clear only the playlist, if
/// it's the database, we clear everything.
/// it's the database, we clear everything.
#[allow(dead_code)]
#[allow(dead_code)]
#[derive(Debug
,
Deserialize,
Serialize
)]
#[derive(Debug)]
pub
struct
AmaDB
{
pub
struct
AmaDB
{
/// Cache requests to lektord and patched karas. The first element is the
/// Cache requests to lektord and patched karas. The first element is the
/// lektord entry, the second one is the patched version.
/// lektord entry, the second one is the patched version.
/// TODO: Find a structure that does COW to not duplicate too much
/// TODO: Find a structure that does COW to not duplicate too much
/// information in the patched version...
/// information in the patched version...
#[serde(skip,
default
=
"new_empty_kara_lru"
)]
karas
:
LruCache
<
i64
,
(
KaraInfo
,
Option
<
KaraInfo
>
)
>
,
karas
:
LruCache
<
i64
,
(
KaraInfo
,
Option
<
KaraInfo
>
)
>
,
/// The playlists. We don't save them...
/// The playlists. We don't save them...
#[serde(skip,
default
=
"new_empty_playlist_lru"
)]
playlists
:
LruCache
<
SmallString
,
Playlist
>
,
playlists
:
LruCache
<
SmallString
,
Playlist
>
,
/// The list of overrides, indexed by the local id of the kara.
/// The list of overrides, indexed by the local id of the kara.
...
@@ -56,6 +54,9 @@ fn new_empty_playlist_lru() -> LruCache<SmallString, Playlist> {
...
@@ -56,6 +54,9 @@ fn new_empty_playlist_lru() -> LruCache<SmallString, Playlist> {
}
}
impl
AmaDB
{
impl
AmaDB
{
/// Create a new empty [AmaDB].
pub
fn
new
()
->
Self
{}
/// Clear the database cache, and only the caches about karas.
/// Clear the database cache, and only the caches about karas.
pub
fn
clear_database_cache
(
&
mut
self
)
{
pub
fn
clear_database_cache
(
&
mut
self
)
{
todo!
()
todo!
()
...
...
Ce diff est replié.
Cliquez pour l'agrandir.
src/rust/amalib/src/db_kara.rs
+
30
−
5
Voir le fichier @
dd4a3927
...
@@ -4,7 +4,7 @@ use crate::*;
...
@@ -4,7 +4,7 @@ use crate::*;
/// Represent the possible types for a song. The custom field is here for
/// Represent the possible types for a song. The custom field is here for
/// flexibility, we box it so it's not too big and because it won't be common.
/// flexibility, we box it so it's not too big and because it won't be common.
#[derive(Debug,
Clone,
PartialEq,
Eq
,
Deserialize,
Serialize
)]
#[derive(Debug,
Clone,
PartialEq,
Eq)]
pub
enum
SongType
{
pub
enum
SongType
{
OP
,
OP
,
ED
,
ED
,
...
@@ -16,8 +16,7 @@ pub enum SongType {
...
@@ -16,8 +16,7 @@ pub enum SongType {
/// Represent the possible origins for a song. The custom field is here for
/// Represent the possible origins for a song. The custom field is here for
/// flexibility, we box it so it's not too big and because it won't be common.
/// flexibility, we box it so it's not too big and because it won't be common.
#[derive(Debug,
Clone,
PartialEq,
Eq,
Deserialize,
Serialize)]
#[derive(Debug,
Clone,
PartialEq,
Eq)]
#[serde(rename_all
=
"lowercase"
)]
pub
enum
SongOrigin
{
pub
enum
SongOrigin
{
Anime
,
Anime
,
VN
,
VN
,
...
@@ -28,7 +27,7 @@ pub enum SongOrigin {
...
@@ -28,7 +27,7 @@ pub enum SongOrigin {
}
}
/// Represent a global id for a kara, the pair (database, id).
/// Represent a global id for a kara, the pair (database, id).
#[derive(Debug,
Deserialize,
Serialize,
Getters,
CopyGetters)]
#[derive(Debug,
Getters,
CopyGetters)]
pub
struct
KaraId
{
pub
struct
KaraId
{
#[getset(get
=
"pub"
)]
#[getset(get
=
"pub"
)]
repo
:
SmallString
,
repo
:
SmallString
,
...
@@ -108,7 +107,7 @@ impl<'a> TaggedObject<'a> for KaraInfo {
...
@@ -108,7 +107,7 @@ impl<'a> TaggedObject<'a> for KaraInfo {
}
}
/// Represent what we want to override in a kara.
/// Represent what we want to override in a kara.
#[derive(Debug,
Clone
,
Deserialize,
Serialize
)]
#[derive(Debug,
Clone)]
pub
enum
KaraInfoOverride
{
pub
enum
KaraInfoOverride
{
SongTitle
(
SmallString
),
SongTitle
(
SmallString
),
SongSource
(
SmallString
),
SongSource
(
SmallString
),
...
@@ -153,3 +152,29 @@ impl KaraInfo {
...
@@ -153,3 +152,29 @@ impl KaraInfo {
!=
0
!=
0
}
}
}
}
impl
From
<&
str
>
for
SongOrigin
{
fn
from
(
value
:
&
str
)
->
Self
{
match
value
{
"anime"
=>
SongOrigin
::
Anime
,
"music"
=>
SongOrigin
::
Music
,
"autre"
=>
SongOrigin
::
Autre
,
"game"
=>
SongOrigin
::
Game
,
"vb"
=>
SongOrigin
::
VN
,
custom
=>
SongOrigin
::
Custom
(
Box
::
new
(
custom
.into
())),
}
}
}
impl
From
<&
str
>
for
SongType
{
fn
from
(
value
:
&
str
)
->
Self
{
match
value
{
"OP"
=>
SongType
::
OP
,
"ED"
=>
SongType
::
ED
,
"IS"
=>
SongType
::
IS
,
"MV"
=>
SongType
::
MV
,
"OT"
=>
SongType
::
OT
,
custom
=>
SongType
::
Custom
(
Box
::
new
(
custom
.into
())),
}
}
}
Ce diff est replié.
Cliquez pour l'agrandir.
Aperçu
0%
Chargement en cours
Veuillez réessayer
ou
joindre un nouveau fichier
.
Annuler
You are about to add
0
people
to the discussion. Proceed with caution.
Terminez d'abord l'édition de ce message.
Enregistrer le commentaire
Annuler
Veuillez vous
inscrire
ou vous
se connecter
pour commenter