Documentation ¶
Overview ¶
Copyright 2020 New Relic Corporation. All rights reserved. SPDX-License-Identifier: Apache-2.0 Package bulk provides utilities and mechanism for sending bulk inventories to the backend, including management of sources from different entities and dividing payloads when they do not fit into the size limits at backend side
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Buffer ¶
type Buffer struct {
// contains filtered or unexported fields
}
Buffer helps creating payloads from multiple PostDeltaBody instances and control their size
func (*Buffer) Add ¶
func (b *Buffer) Add(ent entity.Key, body inventoryapi.PostDeltaBody) error
Add a given payload to buffers and associates it with the given entity. It returns error if: - There is already a payload for the entity - The body can't be marshaled into a JSON - The object is too big for the free space of the buffer
func (Buffer) AsSlice ¶
func (b Buffer) AsSlice() []inventoryapi.PostDeltaBody
AsSlice returns the PostDeltaBody entries as a slice
func (Buffer) Get ¶
func (b Buffer) Get(ent entity.Key) *inventoryapi.PostDeltaBody
Get returns the PostDeltaBody buffered for the given entity ID, or nil if there is no PostDeltaBody for such entity