github.com/noisysockets/netstack@v0.6.0/pkg/sleep/sleep_unsafe_state_autogen.go (about) 1 // automatically generated by stateify. 2 3 package sleep 4 5 import ( 6 "context" 7 8 "github.com/noisysockets/netstack/pkg/state" 9 ) 10 11 func (s *Sleeper) StateTypeName() string { 12 return "pkg/sleep.Sleeper" 13 } 14 15 func (s *Sleeper) StateFields() []string { 16 return []string{ 17 "sharedList", 18 "localList", 19 "allWakers", 20 } 21 } 22 23 func (s *Sleeper) beforeSave() {} 24 25 // +checklocksignore 26 func (s *Sleeper) StateSave(stateSinkObject state.Sink) { 27 s.beforeSave() 28 var sharedListValue *Waker 29 sharedListValue = s.saveSharedList() 30 stateSinkObject.SaveValue(0, sharedListValue) 31 stateSinkObject.Save(1, &s.localList) 32 stateSinkObject.Save(2, &s.allWakers) 33 } 34 35 func (s *Sleeper) afterLoad(context.Context) {} 36 37 // +checklocksignore 38 func (s *Sleeper) StateLoad(ctx context.Context, stateSourceObject state.Source) { 39 stateSourceObject.Load(1, &s.localList) 40 stateSourceObject.Load(2, &s.allWakers) 41 stateSourceObject.LoadValue(0, new(*Waker), func(y any) { s.loadSharedList(ctx, y.(*Waker)) }) 42 } 43 44 func (w *Waker) StateTypeName() string { 45 return "pkg/sleep.Waker" 46 } 47 48 func (w *Waker) StateFields() []string { 49 return []string{ 50 "s", 51 "next", 52 "allWakersNext", 53 } 54 } 55 56 func (w *Waker) beforeSave() {} 57 58 // +checklocksignore 59 func (w *Waker) StateSave(stateSinkObject state.Sink) { 60 w.beforeSave() 61 var sValue wakerState 62 sValue = w.saveS() 63 stateSinkObject.SaveValue(0, sValue) 64 stateSinkObject.Save(1, &w.next) 65 stateSinkObject.Save(2, &w.allWakersNext) 66 } 67 68 func (w *Waker) afterLoad(context.Context) {} 69 70 // +checklocksignore 71 func (w *Waker) StateLoad(ctx context.Context, stateSourceObject state.Source) { 72 stateSourceObject.Load(1, &w.next) 73 stateSourceObject.Load(2, &w.allWakersNext) 74 stateSourceObject.LoadValue(0, new(wakerState), func(y any) { w.loadS(ctx, y.(wakerState)) }) 75 } 76 77 func init() { 78 state.Register((*Sleeper)(nil)) 79 state.Register((*Waker)(nil)) 80 }