@@ -165,11 +165,19 @@ type Manager interface {
165165}
166166
167167// This implements interface Manager
168- type IntelRdtManager struct {
168+ type intelRdtManager struct {
169169 mu sync.Mutex
170- Config * configs.Config
171- Id string
172- Path string
170+ config * configs.Config
171+ id string
172+ path string
173+ }
174+
175+ func NewManager (config * configs.Config , id string , path string ) Manager {
176+ return & intelRdtManager {
177+ config : config ,
178+ id : id ,
179+ path : path ,
180+ }
173181}
174182
175183const (
@@ -534,51 +542,51 @@ func GetIntelRdtPath(id string) (string, error) {
534542}
535543
536544// Applies Intel RDT configuration to the process with the specified pid
537- func (m * IntelRdtManager ) Apply (pid int ) (err error ) {
545+ func (m * intelRdtManager ) Apply (pid int ) (err error ) {
538546 // If intelRdt is not specified in config, we do nothing
539- if m .Config .IntelRdt == nil {
547+ if m .config .IntelRdt == nil {
540548 return nil
541549 }
542- d , err := getIntelRdtData (m .Config , pid )
550+ d , err := getIntelRdtData (m .config , pid )
543551 if err != nil && ! IsNotFound (err ) {
544552 return err
545553 }
546554
547555 m .mu .Lock ()
548556 defer m .mu .Unlock ()
549- path , err := d .join (m .Id )
557+ path , err := d .join (m .id )
550558 if err != nil {
551559 return err
552560 }
553561
554- m .Path = path
562+ m .path = path
555563 return nil
556564}
557565
558566// Destroys the Intel RDT 'container_id' group
559- func (m * IntelRdtManager ) Destroy () error {
567+ func (m * intelRdtManager ) Destroy () error {
560568 m .mu .Lock ()
561569 defer m .mu .Unlock ()
562570 if err := os .RemoveAll (m .GetPath ()); err != nil {
563571 return err
564572 }
565- m .Path = ""
573+ m .path = ""
566574 return nil
567575}
568576
569577// Returns Intel RDT path to save in a state file and to be able to
570578// restore the object later
571- func (m * IntelRdtManager ) GetPath () string {
572- if m .Path == "" {
573- m .Path , _ = GetIntelRdtPath (m .Id )
579+ func (m * intelRdtManager ) GetPath () string {
580+ if m .path == "" {
581+ m .path , _ = GetIntelRdtPath (m .id )
574582 }
575- return m .Path
583+ return m .path
576584}
577585
578586// Returns statistics for Intel RDT
579- func (m * IntelRdtManager ) GetStats () (* Stats , error ) {
587+ func (m * intelRdtManager ) GetStats () (* Stats , error ) {
580588 // If intelRdt is not specified in config
581- if m .Config .IntelRdt == nil {
589+ if m .config .IntelRdt == nil {
582590 return nil , nil
583591 }
584592
@@ -660,7 +668,7 @@ func (m *IntelRdtManager) GetStats() (*Stats, error) {
660668}
661669
662670// Set Intel RDT "resource control" filesystem as configured.
663- func (m * IntelRdtManager ) Set (container * configs.Config ) error {
671+ func (m * intelRdtManager ) Set (container * configs.Config ) error {
664672 // About L3 cache schema:
665673 // It has allocation bitmasks/values for L3 cache on each socket,
666674 // which contains L3 cache id and capacity bitmask (CBM).
0 commit comments