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
4dc268a3
Valider
4dc268a3
rédigé
Il y a 2 mois
par
Elliu
Parcourir les fichiers
Options
Téléchargements
Correctifs
Plain Diff
NKDB: UpdateHandler: add method to know if we can upgrade from an epoch
parent
cd0e2909
Aucune branche associée trouvée
Aucune étiquette associée trouvée
2 requêtes de fusion
!206
Use incremental upgrades when syncing epochs
,
!197
Draft: Refactor the whole code.
Modifications
2
Afficher les modifications d'espaces
En ligne
Côte à côte
Affichage de
2 fichiers modifiés
lektor_nkdb/src/database/epoch.rs
+15
-4
15 ajouts, 4 suppressions
lektor_nkdb/src/database/epoch.rs
lektor_nkdb/src/database/update.rs
+13
-0
13 ajouts, 0 suppression
lektor_nkdb/src/database/update.rs
avec
28 ajouts
et
4 suppressions
lektor_nkdb/src/database/epoch.rs
+
15
−
4
Voir le fichier @
4dc268a3
...
@@ -17,14 +17,20 @@ pub struct Epoch {
...
@@ -17,14 +17,20 @@ pub struct Epoch {
/// Represent the data contained in an epoch.
/// Represent the data contained in an epoch.
pub
type
EpochData
=
HashMap
<
KId
,
Kara
>
;
pub
type
EpochData
=
HashMap
<
KId
,
Kara
>
;
pub
struct
EpochInfos
(
u64
,
u64
);
pub
struct
EpochInfos
{
pub
id
:
u64
,
pub
validity
:
u64
,
}
/// Represent the keys of the epoch data, e.g. the ids of the kara in this epoch.
/// Represent the keys of the epoch data, e.g. the ids of the kara in this epoch.
pub
type
EpochIds
<
'a
>
=
hash_map
::
Keys
<
'a
,
KId
,
Kara
>
;
pub
type
EpochIds
<
'a
>
=
hash_map
::
Keys
<
'a
,
KId
,
Kara
>
;
impl
From
<
kurisu_api
::
v2
::
Infos
>
for
EpochInfos
{
impl
From
<
kurisu_api
::
v2
::
Infos
>
for
EpochInfos
{
fn
from
(
infos
:
kurisu_api
::
v2
::
Infos
)
->
Self
{
fn
from
(
infos
:
kurisu_api
::
v2
::
Infos
)
->
Self
{
Self
(
infos
.epoch
(),
infos
.epoch_validity
())
Self
{
id
:
infos
.epoch
(),
validity
:
infos
.epoch_validity
(),
}
}
}
}
}
...
@@ -101,6 +107,11 @@ impl Epoch {
...
@@ -101,6 +107,11 @@ impl Epoch {
self
.id
self
.id
}
}
/// Get the validity (version) of the epoch
pub
fn
validity
(
&
self
)
->
u64
{
self
.validity
}
/// Get the number of karas in the epoch.
/// Get the number of karas in the epoch.
pub
fn
len
(
&
self
)
->
usize
{
pub
fn
len
(
&
self
)
->
usize
{
self
.data
.len
()
self
.data
.len
()
...
@@ -112,7 +123,7 @@ impl Epoch {
...
@@ -112,7 +123,7 @@ impl Epoch {
}
}
pub
fn
set_infos
(
&
mut
self
,
infos
:
EpochInfos
)
{
pub
fn
set_infos
(
&
mut
self
,
infos
:
EpochInfos
)
{
self
.id
=
infos
.
0
;
self
.id
=
infos
.
id
;
self
.validity
=
infos
.
1
;
self
.validity
=
infos
.
validity
;
}
}
}
}
Ce diff est replié.
Cliquez pour l'agrandir.
lektor_nkdb/src/database/update.rs
+
13
−
0
Voir le fichier @
4dc268a3
...
@@ -44,6 +44,19 @@ impl<'a, Storage: DatabaseStorage> UpdateHandler<'a, Storage> {
...
@@ -44,6 +44,19 @@ impl<'a, Storage: DatabaseStorage> UpdateHandler<'a, Storage> {
}
}
}
}
/// If the epoch is updatable from using the repository described at infos,
/// then return Some(from), where from is the epoch to start updating from
/// (= the epoch id of last_epoch)
pub
async
fn
recoverable_since
(
&
self
,
infos
:
EpochInfos
)
->
Option
<
u64
>
{
match
self
.last_epoch
{
None
=>
None
,
Some
(
last
)
if
last
.validity
()
!=
infos
.validity
=>
None
,
Some
(
last
)
if
last
.num
()
<
infos
.id
=>
Some
(
last
.num
()),
_
=>
None
,
}
}
/// Set EpochInfos for last_epoch
pub
async
fn
set_epoch_infos
(
&
self
,
infos
:
EpochInfos
)
{
pub
async
fn
set_epoch_infos
(
&
self
,
infos
:
EpochInfos
)
{
self
.new_epoch
.borrow_mut
()
.content
()
.set_infos
(
infos
)
self
.new_epoch
.borrow_mut
()
.content
()
.set_infos
(
infos
)
}
}
...
...
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