@@ -393,12 +393,6 @@ type Kernel struct {
393
393
UnixSocketOpts transport.UnixSocketOpts
394
394
}
395
395
396
- // Saver is an interface for saving the kernel.
397
- type Saver interface {
398
- SaveAsync () error
399
- SpecEnviron (containerName string ) []string
400
- }
401
-
402
396
// InitKernelArgs holds arguments to Init.
403
397
type InitKernelArgs struct {
404
398
// FeatureSet is the emulated CPU feature set.
@@ -1921,28 +1915,6 @@ func (k *Kernel) SetHostMount(mnt *vfs.Mount) {
1921
1915
k .hostMount = mnt
1922
1916
}
1923
1917
1924
- // AddStateToCheckpoint adds a key-value pair to be additionally checkpointed.
1925
- func (k * Kernel ) AddStateToCheckpoint (key , v any ) {
1926
- k .checkpointMu .Lock ()
1927
- defer k .checkpointMu .Unlock ()
1928
- if k .additionalCheckpointState == nil {
1929
- k .additionalCheckpointState = make (map [any ]any )
1930
- }
1931
- k .additionalCheckpointState [key ] = v
1932
- }
1933
-
1934
- // PopCheckpointState pops a key-value pair from the additional checkpoint
1935
- // state. If the key doesn't exist, nil is returned.
1936
- func (k * Kernel ) PopCheckpointState (key any ) any {
1937
- k .checkpointMu .Lock ()
1938
- defer k .checkpointMu .Unlock ()
1939
- if v , ok := k .additionalCheckpointState [key ]; ok {
1940
- delete (k .additionalCheckpointState , key )
1941
- return v
1942
- }
1943
- return nil
1944
- }
1945
-
1946
1918
// HostMount returns the hostfs mount.
1947
1919
func (k * Kernel ) HostMount () * vfs.Mount {
1948
1920
return k .hostMount
@@ -2202,79 +2174,3 @@ func (k *Kernel) ContainerName(cid string) string {
2202
2174
defer k .extMu .Unlock ()
2203
2175
return k .containerNames [cid ]
2204
2176
}
2205
-
2206
- // SetSaver sets the kernel's Saver.
2207
- // Thread-compatible.
2208
- func (k * Kernel ) SetSaver (s Saver ) {
2209
- k .checkpointMu .Lock ()
2210
- defer k .checkpointMu .Unlock ()
2211
- k .saver = s
2212
- }
2213
-
2214
- // Saver returns the kernel's Saver.
2215
- // Thread-compatible.
2216
- func (k * Kernel ) Saver () Saver {
2217
- k .checkpointMu .Lock ()
2218
- defer k .checkpointMu .Unlock ()
2219
- return k .saver
2220
- }
2221
-
2222
- // IncCheckpointCount increments the checkpoint counter.
2223
- func (k * Kernel ) IncCheckpointCount () {
2224
- k .checkpointMu .Lock ()
2225
- defer k .checkpointMu .Unlock ()
2226
- k .checkpointCounter ++
2227
- }
2228
-
2229
- // CheckpointCount returns the current checkpoint count. Note that the result
2230
- // may be stale by the time the caller uses it.
2231
- func (k * Kernel ) CheckpointCount () uint32 {
2232
- k .checkpointMu .Lock ()
2233
- defer k .checkpointMu .Unlock ()
2234
- return k .checkpointCounter
2235
- }
2236
-
2237
- // OnCheckpointAttempt is called when a checkpoint attempt is completed. err is
2238
- // any checkpoint errors that may have occurred.
2239
- func (k * Kernel ) OnCheckpointAttempt (err error ) {
2240
- k .checkpointMu .Lock ()
2241
- defer k .checkpointMu .Unlock ()
2242
- if err == nil {
2243
- k .checkpointCounter ++
2244
- }
2245
- k .lastCheckpointStatus = err
2246
- k .checkpointCond .Broadcast ()
2247
- }
2248
-
2249
- // ResetCheckpointStatus resets the last checkpoint status, indicating a new
2250
- // checkpoint is in progress. Caller must call OnCheckpointAttempt when the
2251
- // checkpoint attempt is completed.
2252
- func (k * Kernel ) ResetCheckpointStatus () {
2253
- k .checkpointMu .Lock ()
2254
- defer k .checkpointMu .Unlock ()
2255
- k .lastCheckpointStatus = nil
2256
- }
2257
-
2258
- // WaitCheckpoint waits for the Kernel to have been successfully checkpointed
2259
- // n-1 times, then waits for either the n-th successful checkpoint (in which
2260
- // case it returns nil) or any number of failed checkpoints (in which case it
2261
- // returns an error returned by any such failure).
2262
- func (k * Kernel ) WaitCheckpoint (n uint32 ) error {
2263
- if n == 0 {
2264
- return nil
2265
- }
2266
- k .checkpointMu .Lock ()
2267
- defer k .checkpointMu .Unlock ()
2268
- if k .checkpointCounter >= n {
2269
- // n-th checkpoint already completed successfully.
2270
- return nil
2271
- }
2272
- for k .checkpointCounter < n {
2273
- if k .checkpointCounter == n - 1 && k .lastCheckpointStatus != nil {
2274
- // n-th checkpoint was attempted but it had failed.
2275
- return k .lastCheckpointStatus
2276
- }
2277
- k .checkpointCond .Wait ()
2278
- }
2279
- return nil
2280
- }
0 commit comments