@@ -5,13 +5,13 @@ use super::job::{IndexedRequest, Job, JobResult};
5
5
use super :: StoreSegmentRequest ;
6
6
use libsql_sys:: name:: NamespaceName ;
7
7
8
- struct NamespaceRequests < C , F > {
9
- requests : VecDeque < IndexedRequest < C , F > > ,
8
+ struct NamespaceRequests < F > {
9
+ requests : VecDeque < IndexedRequest < F > > ,
10
10
/// there's work in flight for this namespace
11
11
in_flight : bool ,
12
12
}
13
13
14
- impl < C , F > Default for NamespaceRequests < C , F > {
14
+ impl < F > Default for NamespaceRequests < F > {
15
15
fn default ( ) -> Self {
16
16
Self {
17
17
requests : Default :: default ( ) ,
@@ -28,14 +28,14 @@ impl<C, F> Default for NamespaceRequests<C, F> {
28
28
/// processed, because only the most recent segment is checked for durability. This property
29
29
/// ensures that all segments are present up to the max durable index.
30
30
/// It is generic over C: the storage config type (for config overrides), and T, the segment type
31
- pub ( crate ) struct Scheduler < C , T > {
31
+ pub ( crate ) struct Scheduler < T > {
32
32
/// notify new durability index for namespace
33
- requests : HashMap < NamespaceName , NamespaceRequests < C , T > > ,
33
+ requests : HashMap < NamespaceName , NamespaceRequests < T > > ,
34
34
queue : priority_queue:: PriorityQueue < NamespaceName , Reverse < u64 > > ,
35
35
next_request_id : u64 ,
36
36
}
37
37
38
- impl < C , T > Scheduler < C , T > {
38
+ impl < T > Scheduler < T > {
39
39
pub fn new ( ) -> Self {
40
40
Self {
41
41
requests : Default :: default ( ) ,
@@ -46,7 +46,7 @@ impl<C, T> Scheduler<C, T> {
46
46
47
47
/// Register a new request with the scheduler
48
48
#[ tracing:: instrument( skip_all) ]
49
- pub fn register ( & mut self , request : StoreSegmentRequest < C , T > ) {
49
+ pub fn register ( & mut self , request : StoreSegmentRequest < T > ) {
50
50
// invariant: new segment comes immediately after the latest segment for that namespace. This means:
51
51
// - immediately after the last registered segment, if there is any
52
52
// - immediately after the last durable index
@@ -71,7 +71,7 @@ impl<C, T> Scheduler<C, T> {
71
71
/// be scheduled, and returns description of the job to be performed. No other job for this
72
72
/// namespace will be scheduled, until the `JobResult` is reported
73
73
#[ tracing:: instrument( skip_all) ]
74
- pub fn schedule ( & mut self ) -> Option < Job < C , T > > {
74
+ pub fn schedule ( & mut self ) -> Option < Job < T > > {
75
75
let ( name, _) = self . queue . pop ( ) ?;
76
76
let requests = self
77
77
. requests
@@ -90,7 +90,7 @@ impl<C, T> Scheduler<C, T> {
90
90
/// Report the job result to the scheduler. If the job result was a success, the request as
91
91
/// removed from the queue, else, the job is rescheduled
92
92
#[ tracing:: instrument( skip_all, fields( req_id = result. job. request. id) ) ]
93
- pub async fn report ( & mut self , result : JobResult < C , T > ) {
93
+ pub async fn report ( & mut self , result : JobResult < T > ) {
94
94
// re-schedule, or report new max durable frame_no for segment
95
95
let name = result. job . request . request . namespace . clone ( ) ;
96
96
let requests = self
@@ -151,7 +151,7 @@ mod test {
151
151
152
152
#[ tokio:: test]
153
153
async fn schedule_simple ( ) {
154
- let mut scheduler = Scheduler :: < ( ) , ( ) > :: new ( ) ;
154
+ let mut scheduler = Scheduler :: < ( ) > :: new ( ) ;
155
155
156
156
let ns1 = NamespaceName :: from ( "test1" ) ;
157
157
let ns2 = NamespaceName :: from ( "test2" ) ;
@@ -224,7 +224,7 @@ mod test {
224
224
225
225
#[ tokio:: test]
226
226
async fn job_error_reschedule ( ) {
227
- let mut scheduler = Scheduler :: < ( ) , ( ) > :: new ( ) ;
227
+ let mut scheduler = Scheduler :: < ( ) > :: new ( ) ;
228
228
229
229
let ns1 = NamespaceName :: from ( "test1" ) ;
230
230
let ns2 = NamespaceName :: from ( "test2" ) ;
@@ -264,7 +264,7 @@ mod test {
264
264
265
265
#[ tokio:: test]
266
266
async fn schedule_while_in_flight ( ) {
267
- let mut scheduler = Scheduler :: < ( ) , ( ) > :: new ( ) ;
267
+ let mut scheduler = Scheduler :: < ( ) > :: new ( ) ;
268
268
269
269
let ns1 = NamespaceName :: from ( "test1" ) ;
270
270
0 commit comments