Documentation ¶
Overview ¶
Package types defines the common types for (un)marshalling elements of the lxkns information model from/to JSON.
- PIDMap wraps model.PIDMap
- ProcessTable wraps model.ProcessTable
- (Process wraps model.Process, but is not intended for direct consumption)
Discovery Results ¶
Most lxkns API users probably want to simply marshal and unmarshal discovery results without any hassle. So, here we go:
To marshall a given discover.Result in a service:
allns := discover.Namespaces(discover.StandardDiscovery()) err := json.Marshal(NewDiscoveryResult(WithResult(allns)))
And then to unmarshall a discovery result into "allns" when consuming a discovery service:
disco := NewDiscoveryResult() err := json.Unmarshal(jsondata, disco) allns := disco.Result()
Process Table ¶
Process Tables of type model.ProcessTable are un/marshalled from/to JSON with the help of the ProcessTable type from this package.
Because the Linux architecture closely couples processes and namespaces, all processes in the process table always reference namespaces. This poses a slight difficulty when unmarshalling, because we need to deal with two separate elements which can unmarshalled only sequentially, not simultaneously (whatever "simultaneously" would actually mean). Because we have no control over the order in which the process table and the namespaces will be unmarshalled, whenever we get references to namespaces which we cannot resolve yet, we simply "pre-create" namespace objects (we prime the namespace map). These will then later be completely unmarshalled. For this to work, a ProcessTable needs a reference to a NamespacesDict in order to pre-create the correct namespace objects (ID and type only).
Fortunately, it is also possible to un/marshal a stand-alone ProcessTable only; in this case the unmarshalled process table will reference only the pre-created minimal Namespace objects. Such minimal Namespace objects contain only a valid ID and type; all other information is missing (zero values).
PID Maps for Translating PIDs between PID Namespaces ¶
PID maps of type model.PIDMap are un/marshalled from/to JSON with the help of the PIDMap type from this package.
To marshal an model.PIDMap, create a wrapper object ("Digital Twin") and marshal the wrapper as you need:
// This is one way to get a PID map to be marshalled next. pidmap := model.NewPIDMap(discover.Discovery(discover.FullDiscovery)) // Wrap the PID map and then marshal it... out, err := json.Marshal(NewPIDMap(WithPIDMap(allpidmap)))
Unmarshalling can be done either without or with an additional PID namespace context. Without a PID namespace context is useful when just unmarshalling the PID map and the PID namespaces need only to be known in terms of their IDs (and PID type), but without further namespace details (which isn't included in the PID map anyway).
pm := NewPIDMap() err := json.Unmarshal(out, &pm) pidmap := pm.PIDMap // access wrapped model.PIDMap
Index ¶
- Constants
- type ContainerMap
- type ContainerMarshal
- type ContainerModel
- type ContainerUnMarshal
- type DiscoveryOptions
- type DiscoveryResult
- func (dr DiscoveryResult) Get(name string) interface{}
- func (dr DiscoveryResult) MarshalJSON() ([]byte, error)
- func (dr DiscoveryResult) Mounts() discover.NamespacedMountPathMap
- func (dr DiscoveryResult) Processes() model.ProcessTable
- func (dr DiscoveryResult) Result() *discover.Result
- func (dr *DiscoveryResult) UnmarshalJSON(data []byte) error
- type EngineMap
- type EngineMarshal
- type GroupMap
- type GroupMarshal
- type GroupUnMarshal
- type MountPath
- type MountPathMap
- type NamespaceMarshal
- type NamespaceUnMarshal
- type NamespacedMountMap
- type NamespacesDict
- type NamespacesSetReferences
- type NewDiscoveryResultOption
- type NewPIDMapOption
- type NewProcessTableOption
- type PIDMap
- type Process
- type ProcessTable
Constants ¶
const ( FieldDiscoveryOptions = "discovery-options" FieldNamespaces = "namespaces" FieldProcesses = "processes" FieldMounts = "mounts" FieldContainers = "containers" FieldContainerEngines = "container-engines" FieldContainerGroups = "container-groups" )
JSON object field names for the standardized discovery result parts.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ContainerMap ¶
type ContainerMap struct { Containers map[uint]*model.Container // map ref IDs to containers. // contains filtered or unexported fields }
ContainerMap wraps a set of discovered model.Containers for JSON (un)marshalling.
func NewContainerMap ¶
func NewContainerMap(cm *ContainerModel, containers []*model.Container) ContainerMap
NewContainerMap returns a ContainerMap optionally initialized from a set of model.Containers.
func (ContainerMap) ContainerByRefID ¶
func (m ContainerMap) ContainerByRefID(refid uint) *model.Container
ContainerByRefID returns the Container object identified by the specified (ref) ID. If the object isn't yet known, a new zero'd object is returned.
func (ContainerMap) ContainerSlice ¶
func (m ContainerMap) ContainerSlice() []*model.Container
ContainerSlice returns the containers stored in the ContainerMap.
func (*ContainerMap) MarshalJSON ¶
func (m *ContainerMap) MarshalJSON() ([]byte, error)
MarshalJSON emits a set of containers in JSON textual format, representing the original object pointers to container engines and groups with ID references (in form of numbers).
func (*ContainerMap) UnmarshalJSON ¶
func (m *ContainerMap) UnmarshalJSON(data []byte) error
UnmarshalJSON converts the JSON textual format back into a set of containers, including resolving container engine and group IDs into object references. Depending on a particular order of unmarshalling containers, engines, and groups, preliminary zero'd container engine and group objects are created, to be filled later as unmarshalling progresses.
type ContainerMarshal ¶
type ContainerMarshal struct { ContainerUnMarshal Labels model.Labels `json:"labels"` // ensure to never marshal nil=null. }
ContainerMarshal basically is ContainerUnMarshal, but brings in its own labels field so that we can ensure to never marshal a nil map without having to change the underlaying information model container object.
type ContainerModel ¶
type ContainerModel struct { Containers ContainerMap ContainerEngines EngineMap Groups GroupMap }
ContainerModel wraps the discovery information model part consisting of containers, their container engines and groups for (un)marshalling from/to JSON.
func NewContainerModel ¶
func NewContainerModel(containers []*model.Container) *ContainerModel
NewContainerModel returns a new ContainerModel for (un)marshalling, optionally preparing it from a list of discovered containers (with managing container engines and groups).
type ContainerUnMarshal ¶
type ContainerUnMarshal struct { Engine uint `json:"engine"` // engine ref IDs. Groups []uint `json:"groups"` // group ref IDs. *model.Container }
ContainerUnMarshal is a model.Container with additional fields for (un)marshalling the engine and group references, as we cannot directly serialize plain pointers in an information model with lots of cycles.
type DiscoveryOptions ¶
type DiscoveryOptions discover.DiscoverOpts
DiscoveryOptions is the (digital) twin of an lxkns DiscoveryOptions, which can be marshalled and unmarshalled to and from JSON. This type usually isn't used on its own but instead as part of un/marshalling the DiscoveryResult type.
func (DiscoveryOptions) MarshalJSON ¶
func (doh DiscoveryOptions) MarshalJSON() ([]byte, error)
MarshalJSON emits discovery options as JSON, handling the slightly involved part of marshalling the list of namespace types included in the discovery scan.
func (*DiscoveryOptions) UnmarshalJSON ¶
func (doh *DiscoveryOptions) UnmarshalJSON(data []byte) error
UnmarshalJSON unmarshals JSON into a DiscoveryOptions type. It especially handles the slightly involved task of unmarshalling a list of namespace types into a bitmap mask of CLONE_NEWxxx namespace type flags.
type DiscoveryResult ¶
type DiscoveryResult struct { // Maps discovery result top-level JSON elements to their (un)marshalling // types (the ones that then must do the real work). Fields map[string]interface{} DiscoveryResult *discover.Result `json:"-"` ContainerModel *ContainerModel `json:"-"` }
DiscoveryResult is basically the (digital) twin of an lxkns DiscoveryResult, adding marshalling and unmarshalling to and from JSON. Besides, DiscoveryResult acts also as an extensible discovery result wrapper that allows API users to freely add their own fields (with objects) to un/marshal additional result fields, as they see fit.
func NewDiscoveryResult ¶
func NewDiscoveryResult(opts ...NewDiscoveryResultOption) *DiscoveryResult
NewDiscoveryResult returns a discovery result object ready for unmarshalling JSON into it or marshalling an existing lxkns discovery result.
func (DiscoveryResult) Get ¶
func (dr DiscoveryResult) Get(name string) interface{}
Get returns the user-specified result extension object for the specified extension field. The field must have been added first with the WithElement option when creating the un/marshalling wrapper object for discovery results.
func (DiscoveryResult) MarshalJSON ¶
func (dr DiscoveryResult) MarshalJSON() ([]byte, error)
MarshalJSON marshals discovery results into their JSON textual representation.
func (DiscoveryResult) Mounts ¶
func (dr DiscoveryResult) Mounts() discover.NamespacedMountPathMap
Mounts returns the namespace'd mount paths and points from the wrapped discover.DiscoveryResult.
func (DiscoveryResult) Processes ¶
func (dr DiscoveryResult) Processes() model.ProcessTable
Processes returns the process table from the wrapped discover.DiscoveryResult.
func (DiscoveryResult) Result ¶
func (dr DiscoveryResult) Result() *discover.Result
Result returns the wrapped discover.DiscoveryResult.
func (*DiscoveryResult) UnmarshalJSON ¶
func (dr *DiscoveryResult) UnmarshalJSON(data []byte) error
UnmarshalJSON unmarshals discovery results from JSON into a DiscoveryResult object, usually obtained with NewDiscoveryResult() first.
type EngineMap ¶
type EngineMap struct {
// contains filtered or unexported fields
}
EngineMap wraps a set of discovered model.ContainerEngines for JSON (un)marshalling.
func NewEngineMap ¶
func NewEngineMap(cm *ContainerModel, containers []*model.Container) EngineMap
NewEngineMap creates a new map for ContainerEngines, optionally building using a discovered list of containers (with their ContainerEngines).
func (EngineMap) EngineByRefID ¶
func (m EngineMap) EngineByRefID(refid uint) *model.ContainerEngine
EngineByRefID returns the ContainerEngine associated with a (ref) ID, creating a new zero ContainerEngine if necessary.
func (EngineMap) EngineRefID ¶
func (m EngineMap) EngineRefID(engine *model.ContainerEngine) uint
EngineRefID returns the (ref) ID associated with a particular ContainerEngine.
func (*EngineMap) MarshalJSON ¶
MarshalJSON emits a set of container engines in JSON textual format, representing the original object pointers to containers with ID references (in form of numbers).
func (*EngineMap) UnmarshalJSON ¶
UnmarshalJSON converts the JSON textual format back into a set of container engines, including resolving container IDs into object references. Depending on a particular order of unmarshalling containers, engines, and groups, preliminary zero'd container objects are created, to be filled later as unmarshalling progresses.
type EngineMarshal ¶
type EngineMarshal struct { Containers []uint `json:"containers"` // container ref IDs. *model.ContainerEngine }
EngineMarshal is a model.ContainerEngine with additional fields for (un)marshalling the container references, as we cannot directly serialize plain pointers in an information model with lots of cycles.
type GroupMap ¶
type GroupMap struct {
// contains filtered or unexported fields
}
GroupMap wraps a set of discovered model.Groups for JSON (un)marshalling.
func NewGroupMap ¶
func NewGroupMap(cm *ContainerModel, containers []*model.Container) GroupMap
NewGroupMap creates a new map for Groups.
func (GroupMap) GroupByRefID ¶
GroupByRefID returns the ContainerEngine associated with a (ref) ID, creating a new zero Group if necessary.
func (GroupMap) GroupRefID ¶
GroupRefID returns the (ref) ID associated with a particular Group.
func (*GroupMap) MarshalJSON ¶
MarshalJSON emits a set of groups in JSON textual format, representing the original object pointers to containers with ID references (in form of numbers).
func (*GroupMap) UnmarshalJSON ¶
UnmarshalJSON converts the JSON textual format back into a set of groups, including resolving container IDs into object references. Depending on a particular order of unmarshalling containers, engines, and groups, preliminary zero'd container objects are created, to be filled later as unmarshalling progresses.
type GroupMarshal ¶
type GroupMarshal struct { GroupUnMarshal Labels model.Labels `json:"labels"` // ensure to never marshal nil=nill. }
GroupMarshal is the evil twin to GroupUnmarshal, taking care of nil label maps.
type GroupUnMarshal ¶
type GroupUnMarshal struct { Containers []uint `json:"containers"` // container ref IDs. *model.Group }
GroupUnMarshal is a model.Group with additional fields for (un)marshalling the container references, as we cannot directly serialize plain pointers in an information model with lots of cycles.
type MountPath ¶
type MountPath struct { *mounts.MountPath ID int `json:"pathid"` // unique mount path identifier, per mount namespace. ParentID int `json:"parentid"` // ID of parent mount path, if any, otherwise 0. }
MountPath wraps a mounts.MountPathMap so that it can be marshalled with identifiers in place of mount path object references.
type MountPathMap ¶
type MountPathMap mounts.MountPathMap
MountPathMap is a JSON marshallable mount path map.
func (MountPathMap) MarshalJSON ¶
func (m MountPathMap) MarshalJSON() ([]byte, error)
MarshalJSON emits an object (map/dictionary) of mount paths with their mount point(s) all belonging a single mount namespace.
func (*MountPathMap) UnmarshalJSON ¶
func (m *MountPathMap) UnmarshalJSON(data []byte) error
UnmarshalJSON decodes an object mapping mount paths to their mount point(s). This restores not only the object hierarchy of the mount paths, but also of the mount points corresponding with the mount paths.
type NamespaceMarshal ¶
type NamespaceMarshal struct { NamespaceUnMarshal Ealdorman model.PIDType `json:"ealdorman,omitempty"` // PID of most senior leader process Children []uint64 `json:"children,omitempty"` // PID/user: IDs of child namespaces Tenants []uint64 `json:"possessions,omitempty"` // user: list of owned namespace IDs }
NamespaceMarshal adds those fields to NamespaceUnmarshal we marshal as a convenience to some JSON consumers, but which we rather prefer to ignore on unmarshalling.
type NamespaceUnMarshal ¶
type NamespaceUnMarshal struct { ID uint64 `json:"nsid"` // namespace ID. Type string `json:"type"` // "net", "user", et cetera... Owner uint64 `json:"owner,omitempty"` // namespace ID of owning user namespace. Ref model.NamespaceRef `json:"reference,omitempty"` // file system path reference(s). Leaders []model.PIDType `json:"leaders,omitempty"` // list of leader PIDs. Parent uint64 `json:"parent,omitempty"` // PID/user: namespace ID of parent namespace. UserUID int `json:"user-id,omitempty"` // user: owner's user ID (UID). UserName string `json:"user-name,omitempty"` // user: name. }
NamespaceUnMarshal is the JSON serializable (digital!) twin to namespace objects, yet just for unmarshalling: the rationale to differentiate between marshalling and unmarshalling is that on unmarshalling we ignore some information which might be present, as we need to regenerate it anyway after unmarshalling (such as the list of children and the owned namespaces).
type NamespacedMountMap ¶
type NamespacedMountMap discover.NamespacedMountPathMap
NamespacedMountMap is a JSON marshallable map from mount namespace identifiers (inode numbers only) to their respective mount path maps. The mount path maps further reference mount points.
func (NamespacedMountMap) MarshalJSON ¶
func (m NamespacedMountMap) MarshalJSON() ([]byte, error)
MarshalJSON emits an object (map/dictionary) of mount namespace identifiers (inode numbers only) with their corresponding mount path maps.
func (*NamespacedMountMap) UnmarshalJSON ¶
func (m *NamespacedMountMap) UnmarshalJSON(data []byte) error
UnmarshalJSON decodes an object (map/dictionary) of mount namespaced mount path maps (with mount points).
type NamespacesDict ¶
type NamespacesDict struct { *model.AllNamespaces ProcessTable // our enhanced process table ;) }
NamespacesDict is a dictionary of all namespaces, basically a model.AllNamespaces but with the added twist of creating new preliminary namespace objects when looking up namespaces which we don't have seen yet.
func NewNamespacesDict ¶
func NewNamespacesDict(discoveryresults *discover.Result) *NamespacesDict
NewNamespacesDict returns a new and properly initialized NamespacesDict ready for use. It will be empty if nil discovery results are specified; otherwise, the information from the discovery results will be used by this namespace dictionary.
func (NamespacesDict) Get ¶
func (d NamespacesDict) Get(nsid species.NamespaceID, nstype species.NamespaceType) model.Namespace
Get always(!) returns a Namespace interface (to a namespace object) with the given ID and type. When the namespace is already known, then it is returned, otherwise a new preliminary namespace object gets created, registered, and returned instead. Preliminary namespace objects have their ID and type set, but everything is still zero, including the reference (path).
func (*NamespacesDict) MarshalJSON ¶
func (d *NamespacesDict) MarshalJSON() ([]byte, error)
MarshalJSON emits a Linux-kernel namespace dictionary as JSON, with details about the individual namespaces.
func (*NamespacesDict) UnmarshalJSON ¶
func (d *NamespacesDict) UnmarshalJSON(data []byte) error
UnmarshalJSON unmarshals a Linux-kernel namespace dictionary from its JSON textual representation.
func (NamespacesDict) UnmarshalNamespace ¶
func (d NamespacesDict) UnmarshalNamespace(data []byte) (model.Namespace, error)
UnmarshalNamespace retrieves a Namespace from the given textual representation, making use of the additionally specified namespace dictionary to resolve references to other namespaces (if needed, by creating preliminary namespace objects so they can be referenced in advance). Moreover, it also resolves references to (leader) processes, priming the process table if necessary with preliminary process objects.
type NamespacesSetReferences ¶
type NamespacesSetReferences model.NamespacesSet
NamespacesSetReferences is the JSON representation of a set of typed namespace ID references and thus the JSON face to model.NamespaceSet. The set of namespaces is represented in form of a JSON object with the object keys being the namespace types and the IDs then being the number values. Other namespace details are completely ignored, these are on purpose not repeated for each and every process in a potentially large process table.
func (*NamespacesSetReferences) MarshalJSON ¶
func (n *NamespacesSetReferences) MarshalJSON() ([]byte, error)
MarshalJSON emits the textual JSON representation of a set of typed namespace references. Please note that it emits only references in form of namespace IDs only (without device numbers, see also the discussion about bolted horses from open barn dors in the architecture documentation).
func (NamespacesSetReferences) UnmarshalJSON ¶
func (n NamespacesSetReferences) UnmarshalJSON(data []byte) error
UnmarshalJSON simply panics in order to clearly indicate that TypedNamespacesSet are not to be unmarshalled without a namespace dictionary to find existing namespaces in or add new ones just learnt to. Unfortunately, Golang's generic json (un)marshalling mechanism doesn't allow "contexts".
type NewDiscoveryResultOption ¶
type NewDiscoveryResultOption func(newdiscoveryresult *DiscoveryResult)
NewDiscoveryResultOption defines so-called functional options for use with NewDiscoveryResult().
func WithElement ¶
func WithElement(name string, obj interface{}) NewDiscoveryResultOption
WithElement allows API users to add their own top-level elements for un/marshalling to discovery results; for unmarshalling you need to use WithElement() in order to add a non-nil zero value of the correct type in order to be able to unmarshal into the correct type instead of a generic map[string]interface{}:
// foobar is a JSON un/marshallable type of your own. For unmarshalling, // allocate a non-nil zero value, which can be unmarshalled correctly. discoresult := NewDiscoveryResult( WithDiscoveryResult(all), WithElement("foobar", foobar)) json.Marshal(discoresult)
For unmarshalling:
discoresult := NewDiscoveryResult(WithElement("foobar", foobar)) json.Unmarshal(jsondata, discoresult)
func WithResult ¶
func WithResult(result *discover.Result) NewDiscoveryResultOption
WithResult instructs NewDiscoveryResult() to use an existing lxkns discovery result; this is typically used for marshalling only, but not needed for unmarshalling. In the latter case you probably want to prefer starting with a clean slate.
type NewPIDMapOption ¶
type NewPIDMapOption func(newpidmap *PIDMap)
NewPIDMapOption defines so-called functional options to be used with NewPIDMap().
func WithPIDMap ¶
func WithPIDMap(pidmap model.PIDMapper) NewPIDMapOption
WithPIDMap configures a new PIDMap to wrap an existing model.PIDMap; either for marshalling an existing PIDMap or to unmarshal into a pre-allocated PIDMap.
func WithPIDNamespaces ¶
func WithPIDNamespaces(pidnsmap model.NamespaceMap) NewPIDMapOption
WithPIDNamespaces configures a new PIDMap to use an already known map of PID namespaces.
type NewProcessTableOption ¶
type NewProcessTableOption func(newproctable *ProcessTable)
NewProcessTableOption defines so-called functional options to be used with NewProcessTable().
func WithNamespacesDict ¶
func WithNamespacesDict(nsdict *NamespacesDict) NewProcessTableOption
WithNamespacesDict specifies an existing namespaces dictionary to make use of while unmarshalling the namespace references of processes in a process table.
func WithProcessTable ¶
func WithProcessTable(proctable model.ProcessTable) NewProcessTableOption
WithProcessTable specifies an existing (model) process table to use for marshalling.
type PIDMap ¶
type PIDMap struct { // The real PID map we wrap for the purpose of un/marshalling. PIDMap model.PIDMapper // An optional PID namespace map to reuse for resolving PID namespace // references; this avoids PIDMaps having to create their own "minimalist" // PID namespace objects during unmarshalling. PIDns model.NamespaceMap }
PIDMap is the (Digital) Twin of an model.PIDMap and can be marshalled and unmarshalled to and from JSON. Nota bene: PIDMap is a small object, so it should simply be passed around by value.
To marshal from an existing model.PIDMap:
pm := NewPIDMap(WithPIDMap(mypidmap)) out, err := json.Marshal(pm)
To unmarshal into a fresh model.PIDMap, not caring about PID namespace details beyond PID namespace IDs, simply call NewPIDMap() without any options:
pm := NewPIDMap()
On purpose, the external JSON representation of a PIDMap is reduced compared to an model.PIDMap: this optimizes the transfer size by marshalling only the absolutely necessary information necessary to recreate an model.PIDMap on unmarshalling. In contrast, the process-internal model.PIDMap trades memory consumption for performance, in oder to speed up translating PIDs between different PID namespaces.
func NewPIDMap ¶
func NewPIDMap(opts ...NewPIDMapOption) PIDMap
NewPIDMap creates a new twin of either an existing model.PIDMap or allocates a new and empty model.PIDMap.
func (PIDMap) MarshalJSON ¶
MarshalJSON emits a PIDMap as JSON. To reduce the transfer volume, this method only emits enough table data for UnmarshalJSON() later being able to regenerate the full table.
func (*PIDMap) UnmarshalJSON ¶
UnmarshalJSON converts the textual JSON representation of a PID map back into the binary object state.
type Process ¶
Process is the JSON representation of the information about a single process. The Process type is designed to be used under the hood of ProcessTable and not directly by 3rd (external) party users.
func (*Process) MarshalJSON ¶
MarshalJSON emits the textual JSON representation of a single process.
Please note that marshalling uses a pointer receiver, so make sure to have a *Process when unmarshalling, as otherwise this method won't get called. The rationale for a pointer receiver as opposed to a value receiver is that as a Process contains some more data "beyond two ints", we don't want them to be passed around as values all the time, copying and copying again.
And now some sour tangarine somewhere surely is claiming this total Golang design fubar to be absolutely great, innit?
func (*Process) UnmarshalJSON ¶
UnmarshalJSON simply panics in order to clearly indicate that Process is not to be unmarshalled without a namespace dictionary to find existing namespaces in or add new ones just learnt to. Unfortunately, Golang's generic json (un)marshalling mechanism doesn't allow "contexts".
type ProcessTable ¶
type ProcessTable struct { model.ProcessTable Namespaces *NamespacesDict // for resolving (and priming) namespace references }
ProcessTable is the JSON serializable (digital!) twin to the process table returned from discoveries. The processes (process tree) is represented in JSON as a JSON object, where the members (keys) are the stringified PIDs and the values are process objects.
In order to unmarshal a ProcessTable a namespace dictionary is required, which can either be prefilled or empty: it is used to share the namespace objects with the same ID between individual process objects in the table.
Additionally, a ProcessTable can be primed with ("preliminary") Process objects. In this case, these process objects will be reused and updated with the new state. Please see also the Get() method, which will automatically do priming for yet unknown PIDs.
func NewProcessTable ¶
func NewProcessTable(opts ...NewProcessTableOption) ProcessTable
NewProcessTable creates a new process table that can be un/marshalled from or to JSON. Without any options, the process table returned can be used for unmarshalling right from the start. For marshalling an existing (hopefully filled) process table, use the WithProcessTable() option to specify the process table to use.
func (*ProcessTable) Get ¶
func (p *ProcessTable) Get(pid model.PIDType) *model.Process
Get always(!) returns a Process object with the given PID. When the process is already known, then it is returned, else a new preliminary process object gets created, registered, and returned instead. Preliminary process objects have only their PID set, but nothing else with the sole exception for the list of child processes being initialized.
func (ProcessTable) MarshalJSON ¶
func (p ProcessTable) MarshalJSON() ([]byte, error)
MarshalJSON emits the JSON textual representation of a complete process table.
func (*ProcessTable) UnmarshalJSON ¶
func (p *ProcessTable) UnmarshalJSON(data []byte) error
UnmarshalJSON reads in the textual JSON representation of a complete process table. It makes use of the namespace object dictionary associated with this process table instance.