github.com/Rookout/GoSDK@v0.1.48/pkg/augs/aug_namespace.go (about)

     1  package augs
     2  
     3  import (
     4  	"github.com/Rookout/GoSDK/pkg/processor/namespaces"
     5  	"github.com/Rookout/GoSDK/pkg/rookoutErrors"
     6  	"github.com/Rookout/GoSDK/pkg/services/collection"
     7  )
     8  
     9  type augNamespace struct {
    10  	namespace namespaces.Namespace
    11  }
    12  
    13  func newAugNamespace(collectionService *collection.CollectionService) (*augNamespace, rookoutErrors.RookoutError) {
    14  	frame := namespaces.NewFrameNamespace(collectionService)
    15  	stack := namespaces.NewStackNamespace(collectionService)
    16  	
    17  	utils := namespaces.NewGoUtilsNameSpace(collectionService.GoroutineID())
    18  	
    19  	trace := namespaces.NewNoopNamespace()
    20  	
    21  	state := namespaces.NewEmptyContainerNamespace()
    22  	
    23  	extracted := namespaces.NewNoopNamespace()
    24  
    25  	namespace := namespaces.NewEmptyContainerNamespace()
    26  	namespace.OnClose = collectionService.Close
    27  	err := namespace.WriteAttribute("frame", frame)
    28  	if err != nil {
    29  		return nil, err
    30  	}
    31  	err = namespace.WriteAttribute("stack", stack)
    32  	if err != nil {
    33  		return nil, err
    34  	}
    35  	err = namespace.WriteAttribute("store", namespaces.NewEmptyContainerNamespace())
    36  	if err != nil {
    37  		return nil, err
    38  	}
    39  	err = namespace.WriteAttribute("trace", trace)
    40  	if err != nil {
    41  		return nil, err
    42  	}
    43  	err = namespace.WriteAttribute("state", state)
    44  	if err != nil {
    45  		return nil, err
    46  	}
    47  	err = namespace.WriteAttribute("utils", utils)
    48  	if err != nil {
    49  		return nil, err
    50  	}
    51  	err = namespace.WriteAttribute("extracted", extracted)
    52  	if err != nil {
    53  		return nil, err
    54  	}
    55  
    56  	return &augNamespace{
    57  		namespace: namespace,
    58  	}, nil
    59  }
    60  
    61  func (a *augNamespace) GetAugNamespace() namespaces.Namespace {
    62  	return a.namespace
    63  }