func (s *static) HandleEvent(*events.Policy) (bool, error) {
	s.Debug("(not) handling event...")
	return false, nil
}
HandleEvent handles policy-specific events.
package static
import (
	"fmt"
	"strconv"
	corev1 "k8s.io/api/core/v1"
	"k8s.io/apimachinery/pkg/api/resource"
	"k8s.io/kubernetes/pkg/kubelet/cm/cpuset"
	"github.com/intel/cri-resource-manager/pkg/config"
	logger "github.com/intel/cri-resource-manager/pkg/log"
	"github.com/intel/cri-resource-manager/pkg/cpuallocator"
	"github.com/intel/cri-resource-manager/pkg/cri/resource-manager/cache"
	"github.com/intel/cri-resource-manager/pkg/cri/resource-manager/events"
	"github.com/intel/cri-resource-manager/pkg/cri/resource-manager/introspect"
	"github.com/intel/cri-resource-manager/pkg/cri/resource-manager/kubernetes"
	"github.com/intel/cri-resource-manager/pkg/cri/resource-manager/policy"
	"github.com/intel/cri-resource-manager/pkg/sysfs"
	idset "github.com/intel/goresctrl/pkg/utils"
)
const (
	PolicyName = "static"
	PolicyDescription = "A reimplementation of the static CPU Manager policy."
	PolicyPath = "policy." + PolicyName
)
type static struct {
	logger.Logger
	available     policy.ConstraintSet       
	reserved      policy.ConstraintSet       
	reservedCpus  cpuset.CPUSet              
	availableCpus cpuset.CPUSet              
	isolatedCpus  cpuset.CPUSet              
	sys           sysfs.System               
	numHT         int                        
	state         cache.Cache                
	cpuAllocator  cpuallocator.CPUAllocator  
}
var _ policy.Backend = &static{}
const (
	keyPreferIsolated = "prefer-isolated-cpus"
)
func NewStaticPolicy(opts *policy.BackendOptions) policy.Backend {
	s := &static{
		Logger:       logger.NewLogger(PolicyName),
		state:        opts.Cache,
		sys:          opts.System,
		available:    opts.Available,
		reserved:     opts.Reserved,
		cpuAllocator: cpuallocator.NewCPUAllocator(opts.System),
	}
	s.Info("creating policy...")
	s.numHT = s.sys.CPU(idset.ID(0)).ThreadCPUSet().Size()
	if err := s.checkConstraints(); err != nil {
		s.Fatal("cannot start with given constraints: %v", err)
	}
	config.GetModule(PolicyPath).AddNotify(s.configNotify)
	return s
}
func (s *static) Name() string {
	return PolicyName
}
func (s *static) Description() string {
	return PolicyDescription
}
func (s *static) Start(add []cache.Container, del []cache.Container) error {
	s.Debug("starting up...")
	if err := s.allocateReserved(); err != nil {
		return policyError("failed allocate reserved CPUs: %v", err)
	}
	s.Info("using reserved CPUs: %s", s.reservedCpus.String())
	s.Info("using available CPUs: %s", s.availableCpus.String())
	if err := s.validateState(s.state); err != nil {
		return policyError("failed to start with given cache/state: %v", err)
	}
	s.validateAssignments()
	return s.Sync(add, del)
}
func (s *static) Sync(add []cache.Container, del []cache.Container) error {
	s.Debug("synchronizing state...")
	for _, c := range del {
		s.ReleaseResources(c)
	}
	for _, c := range add {
		s.AllocateResources(c)
	}
	return nil
}
func (s *static) AllocateResources(c cache.Container) error {
	s.Info("allocating resource for container %s...", c.PrettyName())
	container := c
	containerID := c.GetCacheID()
	pod, found := c.GetPod()
	if !found {
		return policyError("can't find pod for container %s", containerID)
	}
	err := s.AddContainer(pod, container, containerID)
	return err
}
func (s *static) ReleaseResources(c cache.Container) error {
	s.Info("releasing resources of container %s...", c.PrettyName())
	containerID := c.GetCacheID()
	err := s.RemoveContainer(containerID)
	return err
}
func (s *static) UpdateResources(c cache.Container) error {
	s.Debug("(not) updating container %s...", c.PrettyName())
	return nil
}
func (s *static) Rebalance() (bool, error) {
	s.Debug("(not) rebalancing containers...")
	return false, nil
}