| 1 |
// Copyright The OpenTelemetry Authors |
| 2 |
// SPDX-License-Identifier: Apache-2.0 |
| 3 |
|
| 4 |
// Code generated by "internal/cmd/pdatagen/main.go". DO NOT EDIT. |
| 5 |
// To regenerate this file run "make genpdata". |
| 6 |
|
| 7 |
package plog |
| 8 |
|
| 9 |
import ( |
| 10 |
"go.opentelemetry.io/collector/pdata/internal" |
| 11 |
) |
| 12 |
|
| 13 |
// Logs is the top-level struct that is propagated through the logs pipeline. |
| 14 |
// Use NewLogs to create new instance, zero-initialized instance is not valid for use. |
| 15 |
// |
| 16 |
// This is a reference type, if passed by value and callee modifies it the |
| 17 |
// caller will see the modification. |
| 18 |
// |
| 19 |
// Must use NewLogs function to create new instances. |
| 20 |
// Important: zero-initialized instance is not valid for use. |
| 21 |
type Logs internal.LogsWrapper |
| 22 |
|
| 23 |
func newLogs(orig *internal.ExportLogsServiceRequest, state *internal.State) Logs { |
| 24 |
return Logs(internal.NewLogsWrapper(orig, state)) |
| 25 |
} |
| 26 |
|
| 27 |
// NewLogs creates a new empty Logs. |
| 28 |
// |
| 29 |
// This must be used only in testing code. Users should use "AppendEmpty" when part of a Slice, |
| 30 |
// OR directly access the member if this is embedded in another struct. |
| 31 |
func NewLogs() Logs { |
| 32 |
return newLogs(internal.NewExportLogsServiceRequest(), internal.NewState()) |
| 33 |
} |
| 34 |
|
| 35 |
// MoveTo moves all properties from the current struct overriding the destination and |
| 36 |
// resetting the current instance to its zero value |
| 37 |
func (ms Logs) MoveTo(dest Logs) { |
| 38 |
ms.getState().AssertMutable() |
| 39 |
dest.getState().AssertMutable() |
| 40 |
// If they point to the same data, they are the same, nothing to do. |
| 41 |
if ms.getOrig() == dest.getOrig() { |
| 42 |
return |
| 43 |
} |
| 44 |
internal.DeleteExportLogsServiceRequest(dest.getOrig(), false) |
| 45 |
*dest.getOrig(), *ms.getOrig() = *ms.getOrig(), *dest.getOrig() |
| 46 |
} |
| 47 |
|
| 48 |
// ResourceLogs returns the ResourceLogs associated with this Logs. |
| 49 |
func (ms Logs) ResourceLogs() ResourceLogsSlice { |
| 50 |
return newResourceLogsSlice(&ms.getOrig().ResourceLogs, ms.getState()) |
| 51 |
} |
| 52 |
|
| 53 |
// CopyTo copies all properties from the current struct overriding the destination. |
| 54 |
func (ms Logs) CopyTo(dest Logs) { |
| 55 |
dest.getState().AssertMutable() |
| 56 |
internal.CopyExportLogsServiceRequest(dest.getOrig(), ms.getOrig()) |
| 57 |
} |
| 58 |
|
| 59 |
func (ms Logs) getOrig() *internal.ExportLogsServiceRequest { |
| 60 |
return internal.GetLogsOrig(internal.LogsWrapper(ms)) |
| 61 |
} |
| 62 |
|
| 63 |
func (ms Logs) getState() *internal.State { |
| 64 |
return internal.GetLogsState(internal.LogsWrapper(ms)) |
| 65 |
} |