// automatically generated by stateify.

package faketime

import (
	"context"

	"github.com/sagernet/gvisor/pkg/state"
)

func (n *NullClock) StateTypeName() string {
	return "pkg/tcpip/faketime.NullClock"
}

func (n *NullClock) StateFields() []string {
	return []string{}
}

func (n *NullClock) beforeSave() {}

// +checklocksignore
func (n *NullClock) StateSave(stateSinkObject state.Sink) {
	n.beforeSave()
}

func (n *NullClock) afterLoad(context.Context) {}

// +checklocksignore
func (n *NullClock) StateLoad(ctx context.Context, stateSourceObject state.Source) {
}

func (n *nullTimer) StateTypeName() string {
	return "pkg/tcpip/faketime.nullTimer"
}

func (n *nullTimer) StateFields() []string {
	return []string{}
}

func (n *nullTimer) beforeSave() {}

// +checklocksignore
func (n *nullTimer) StateSave(stateSinkObject state.Sink) {
	n.beforeSave()
}

func (n *nullTimer) afterLoad(context.Context) {}

// +checklocksignore
func (n *nullTimer) StateLoad(ctx context.Context, stateSourceObject state.Source) {
}

func (m *manualClockMutex) StateTypeName() string {
	return "pkg/tcpip/faketime.manualClockMutex"
}

func (m *manualClockMutex) StateFields() []string {
	return []string{
		"now",
		"times",
		"timers",
	}
}

func (m *manualClockMutex) beforeSave() {}

// +checklocksignore
func (m *manualClockMutex) StateSave(stateSinkObject state.Sink) {
	m.beforeSave()
	stateSinkObject.Save(0, &m.now)
	stateSinkObject.Save(1, &m.times)
	stateSinkObject.Save(2, &m.timers)
}

func (m *manualClockMutex) afterLoad(context.Context) {}

// +checklocksignore
func (m *manualClockMutex) StateLoad(ctx context.Context, stateSourceObject state.Source) {
	stateSourceObject.Load(0, &m.now)
	stateSourceObject.Load(1, &m.times)
	stateSourceObject.Load(2, &m.timers)
}

func (mc *ManualClock) StateTypeName() string {
	return "pkg/tcpip/faketime.ManualClock"
}

func (mc *ManualClock) StateFields() []string {
	return []string{
		"runningTimers",
		"mu",
	}
}

func (mc *ManualClock) beforeSave() {}

// +checklocksignore
func (mc *ManualClock) StateSave(stateSinkObject state.Sink) {
	mc.beforeSave()
	stateSinkObject.Save(0, &mc.runningTimers)
	stateSinkObject.Save(1, &mc.mu)
}

func (mc *ManualClock) afterLoad(context.Context) {}

// +checklocksignore
func (mc *ManualClock) StateLoad(ctx context.Context, stateSourceObject state.Source) {
	stateSourceObject.Load(0, &mc.runningTimers)
	stateSourceObject.Load(1, &mc.mu)
}

func (m *manualTimerMu) StateTypeName() string {
	return "pkg/tcpip/faketime.manualTimerMu"
}

func (m *manualTimerMu) StateFields() []string {
	return []string{
		"firesAt",
	}
}

func (m *manualTimerMu) beforeSave() {}

// +checklocksignore
func (m *manualTimerMu) StateSave(stateSinkObject state.Sink) {
	m.beforeSave()
	stateSinkObject.Save(0, &m.firesAt)
}

func (m *manualTimerMu) afterLoad(context.Context) {}

// +checklocksignore
func (m *manualTimerMu) StateLoad(ctx context.Context, stateSourceObject state.Source) {
	stateSourceObject.Load(0, &m.firesAt)
}

func (mt *manualTimer) StateTypeName() string {
	return "pkg/tcpip/faketime.manualTimer"
}

func (mt *manualTimer) StateFields() []string {
	return []string{
		"clock",
		"mu",
	}
}

func (mt *manualTimer) beforeSave() {}

// +checklocksignore
func (mt *manualTimer) StateSave(stateSinkObject state.Sink) {
	mt.beforeSave()
	stateSinkObject.Save(0, &mt.clock)
	stateSinkObject.Save(1, &mt.mu)
}

func (mt *manualTimer) afterLoad(context.Context) {}

// +checklocksignore
func (mt *manualTimer) StateLoad(ctx context.Context, stateSourceObject state.Source) {
	stateSourceObject.Load(0, &mt.clock)
	stateSourceObject.Load(1, &mt.mu)
}

func init() {
	state.Register((*NullClock)(nil))
	state.Register((*nullTimer)(nil))
	state.Register((*manualClockMutex)(nil))
	state.Register((*ManualClock)(nil))
	state.Register((*manualTimerMu)(nil))
	state.Register((*manualTimer)(nil))
}
