dataToMemory

package
v0.5.253 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 22, 2021 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DataToMemory

type DataToMemory struct {
	// Português: último evento com o dado, criado ou apagado
	Event Event `json:"e"`

	// Português: timestamp do último evento
	// fixme: colocar network time protocol - NTC
	EventDate time.Time `json:"d"`

	// Português: dado arquivado
	Value interface{} `json:"v"`

	// Português: CRC, cyclic redundancy check, usado para verificar se os dados são os idênticos
	Crc []byte `json:"c"`
}

DataToMemory

Português: Quando um dado é arquivado na memória, dataToMemory arquiva o dado, o evento criado ou apagado, a data do evento e o dado

Quando um dado é apagado, o dado recebe nil e a data do evento é atualizada, mas, é mantida uma indicação em memória com a chave representante do dado para os eventos de sincronismo

Devido ao tempo de sincronismo entre os pods, a atualização do dado sempre considera a data mais nova como sendo a dáta válida durante o sincronismo.

Exemplo: Uma chave criada as 14:00:00 tem prevalência sobre uma chave criada as 13:59:59, pois, trata-se de atualização.

func (*DataToMemory) Delete

func (e *DataToMemory) Delete() (err error)

func (*DataToMemory) Get

func (e *DataToMemory) Get() (event Event, when time.Time, value interface{})

func (*DataToMemory) GetCRC added in v0.5.23

func (e *DataToMemory) GetCRC() (crc []byte)

func (*DataToMemory) GetUnixNano

func (e *DataToMemory) GetUnixNano() (unixValue int64)

func (*DataToMemory) IsDeleted

func (e *DataToMemory) IsDeleted() (deleted bool)

func (*DataToMemory) MarshalJSON added in v0.5.23

func (e *DataToMemory) MarshalJSON() (data []byte, err error)

func (*DataToMemory) Set

func (e *DataToMemory) Set(value interface{}) (err error)

func (*DataToMemory) UnmarshalJSON added in v0.5.23

func (e *DataToMemory) UnmarshalJSON(data []byte) (err error)

type Event

type Event int
const (
	KCreated Event = iota + 1
	KDeleted
)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL