github.com/Rookout/GoSDK@v0.1.48/pkg/processor/namespaces/go_utils_namespace.go (about)

     1  package namespaces
     2  
     3  import (
     4  	"fmt"
     5  
     6  	"github.com/Rookout/GoSDK/pkg/rookoutErrors"
     7  )
     8  
     9  type GoUtilsNamespace struct {
    10  	goid          int
    11  	goroutineName string
    12  }
    13  
    14  func (g *GoUtilsNamespace) CallMethod(name string, args string) (Namespace, rookoutErrors.RookoutError) {
    15  	switch name {
    16  	case "thread_id":
    17  		return NewGoObjectNamespace(g.goid), nil
    18  
    19  	case "thread_name":
    20  		return NewGoObjectNamespace(g.goroutineName), nil
    21  	default:
    22  		
    23  		return NewGoObjectNamespace(nil), nil
    24  	}
    25  }
    26  
    27  func (g *GoUtilsNamespace) WriteAttribute(name string, value Namespace) rookoutErrors.RookoutError {
    28  	return rookoutErrors.NewNotImplemented()
    29  }
    30  
    31  func (g *GoUtilsNamespace) ReadAttribute(name string) (Namespace, rookoutErrors.RookoutError) {
    32  	return nil, rookoutErrors.NewNotImplemented()
    33  }
    34  
    35  func (g *GoUtilsNamespace) ReadKey(key interface{}) (Namespace, rookoutErrors.RookoutError) {
    36  	return nil, rookoutErrors.NewNotImplemented()
    37  }
    38  
    39  func (g *GoUtilsNamespace) GetObject() interface{} {
    40  	return nil
    41  }
    42  
    43  func (g *GoUtilsNamespace) Serialize(serializer Serializer) {
    44  	dumpError(serializer, rookoutErrors.NewNotImplemented())
    45  }
    46  
    47  func NewGoUtilsNameSpace(goid int) *GoUtilsNamespace {
    48  	return &GoUtilsNamespace{goid: goid, goroutineName: fmt.Sprintf("goroutine %d", goid)}
    49  }