// automatically generated by stateify.

package tbf

import (
	"context"

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

func (d *discipline) StateTypeName() string {
	return "pkg/tcpip/link/qdisc/tbf.discipline"
}

func (d *discipline) StateFields() []string {
	return []string{
		"lower",
		"rate",
		"burst",
		"buffer",
		"closed",
		"queue",
		"tokens",
		"timeCheckpoint",
	}
}

func (d *discipline) beforeSave() {}

// +checklocksignore
func (d *discipline) StateSave(stateSinkObject state.Sink) {
	d.beforeSave()
	stateSinkObject.Save(0, &d.lower)
	stateSinkObject.Save(1, &d.rate)
	stateSinkObject.Save(2, &d.burst)
	stateSinkObject.Save(3, &d.buffer)
	stateSinkObject.Save(4, &d.closed)
	stateSinkObject.Save(5, &d.queue)
	stateSinkObject.Save(6, &d.tokens)
	stateSinkObject.Save(7, &d.timeCheckpoint)
}

func (d *discipline) afterLoad(context.Context) {}

// +checklocksignore
func (d *discipline) StateLoad(ctx context.Context, stateSourceObject state.Source) {
	stateSourceObject.Load(0, &d.lower)
	stateSourceObject.Load(1, &d.rate)
	stateSourceObject.Load(2, &d.burst)
	stateSourceObject.Load(3, &d.buffer)
	stateSourceObject.Load(4, &d.closed)
	stateSourceObject.Load(5, &d.queue)
	stateSourceObject.Load(6, &d.tokens)
	stateSourceObject.Load(7, &d.timeCheckpoint)
}

func init() {
	state.Register((*discipline)(nil))
}
