Scheduling defines the interface for scheduling operations in the peer-to-peer download system. It provides methods for selecting parents and candidates for normal and persistent cache tasks, supporting both v1 and v2 gRPC versions, as well as persistent cache replication.
| 46 | // It provides methods for selecting parents and candidates for normal and persistent cache tasks, |
| 47 | // supporting both v1 and v2 gRPC versions, as well as persistent cache replication. |
| 48 | type Scheduling interface { |
| 49 | // ScheduleCandidateParents schedules candidate parents to the given normal peer for task download. |
| 50 | // This method is used exclusively in the v2 gRPC version. |
| 51 | ScheduleCandidateParents(context.Context, *standard.Peer, set.SafeSet[string]) error |
| 52 | |
| 53 | // ScheduleParentAndCandidateParents schedules a primary parent along with candidate parents to the given normal peer for task download. |
| 54 | // This method is used exclusively in the v1 gRPC version. |
| 55 | ScheduleParentAndCandidateParents(context.Context, *standard.Peer, set.SafeSet[string]) |
| 56 | |
| 57 | // FindCandidateParents identifies suitable candidate parents for the given peer to download the task. |
| 58 | // This method is used exclusively in the v2 gRPC version. |
| 59 | FindCandidateParents(context.Context, *standard.Peer, set.SafeSet[string]) ([]*standard.Peer, bool) |
| 60 | |
| 61 | // FindParentAndCandidateParents identifies a primary parent along with suitable candidate parents for the given peer to download the task. |
| 62 | // This method is used exclusively in the v1 gRPC version. |
| 63 | FindParentAndCandidateParents(context.Context, *standard.Peer, set.SafeSet[string]) ([]*standard.Peer, bool) |
| 64 | |
| 65 | // FindReplicatePersistentHosts identifies replication hosts for persistent tasks. It compares the current persistent replica count |
| 66 | // against the target count to select sufficient parents, returning cached replication peers, non-cached replication hosts, and a success flag. |
| 67 | FindReplicatePersistentHosts(context.Context, *persistent.Task, set.SafeSet[string]) ([]*persistent.Peer, []*persistent.Host, bool) |
| 68 | |
| 69 | // FindCandidatePersistentParents identifies suitable candidate parents in the persistent for the given peer to download the task. |
| 70 | FindCandidatePersistentParents(context.Context, *persistent.Peer, set.SafeSet[string]) ([]*persistent.Peer, bool) |
| 71 | |
| 72 | // FindReplicatePersistentCacheHosts identifies replication hosts for persistent cache tasks. It compares the current persistent replica count |
| 73 | // against the target count to select sufficient parents, returning cached replication peers, non-cached replication hosts, and a success flag. |
| 74 | FindReplicatePersistentCacheHosts(context.Context, *persistentcache.Task, set.SafeSet[string]) ([]*persistentcache.Peer, []*persistentcache.Host, bool) |
| 75 | |
| 76 | // FindCandidatePersistentCacheParents identifies suitable candidate parents in the persistent cache for the given peer to download the task. |
| 77 | FindCandidatePersistentCacheParents(context.Context, *persistentcache.Peer, set.SafeSet[string]) ([]*persistentcache.Peer, bool) |
| 78 | } |
| 79 | |
| 80 | // scheduling implements the Scheduling interface, managing peer parent selection and persistent cache replication |
| 81 | // using an evaluator, configuration, resource managers, and dynamic config updates. |
no outgoing calls
no test coverage detected