Skip to content
github-actions[bot] edited this page Dec 29, 2025 · 7 revisions

ipc

import "github.com/AarC10/GSW-V2/lib/ipc"

Index

type Reader

Reader implements a blocking interface for reading from IPC. This is not thread safe.

type Reader interface {
    Read(ctx context.Context) (ReaderMessage, error)
    Cleanup()
}

type ReaderMessage

ReaderMessage represents data read from IPC.

type ReaderMessage interface {
    Data() []byte
}

type ShmHandler

ShmHandler is a shared memory handler for inter-process communication

type ShmHandler struct {
    // contains filtered or unexported fields
}

func CreateShmReader

func CreateShmReader(identifier string, shmDir string) (*ShmHandler, error)

CreateShmReader creates a shared memory reader for inter-process communication

func NewShmHandler

func NewShmHandler(identifier string, telemetryPacketSize int, isWriter bool, shmDir string) (*ShmHandler, error)

NewShmHandler creates a shared memory handler for inter-process communication

func (*ShmHandler) Cleanup

func (handler *ShmHandler) Cleanup()

Cleanup cleans up the shared memory handler and removes the shared memory file

func (*ShmHandler) Read

func (handler *ShmHandler) Read(ctx context.Context) (ReaderMessage, error)

Read the current message in shared memory.

func (*ShmHandler) ReadRaw

func (handler *ShmHandler) ReadRaw() ([]byte, error)

ReadRaw returns a copy of the current packet in SHM.

func (*ShmHandler) Write

func (handler *ShmHandler) Write(data []byte) error

Write sends a message to shared memory

type ShmReaderMessage

ShmReaderMessage is a message read by an ShmHandler

type ShmReaderMessage struct {
    // contains filtered or unexported fields
}

func (*ShmReaderMessage) Data

func (m *ShmReaderMessage) Data() []byte

Data returns the message data.

func (*ShmReaderMessage) Futex

func (m *ShmReaderMessage) Futex() uint32

ReceiveTimestamp returns the message futex value (an incrementing counter). This could be used to estimate message loss.

func (*ShmReaderMessage) ReceiveTimestamp

func (m *ShmReaderMessage) ReceiveTimestamp() uint64

ReceiveTimestamp returns the unix timestamp when the message was received (nanoseconds since epoch).

type Writer

Writer is an interface for sending data across processes

type Writer interface {
    Write(data []byte) error
    Cleanup()
}

Generated by gomarkdoc

Clone this wiki locally