protoio

package
v1.13.0 Latest Latest
Warning

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

Go to latest
Published: Dec 24, 2023 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Overview

Package protoio contains I/O functions for protocol buffers.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ReadMessage

func ReadMessage(fname string, pb proto.Message) error

ReadMessage reads a protocol buffer message from fname, and unmarshalls it into pb.

func ReadTextMessage

func ReadTextMessage(fname string, pb proto.Message) error

ReadTextMessage reads a text format protocol buffer message from fname, and unmarshalls it into pb.

func WriteMessage

func WriteMessage(fname string, pb proto.Message, perm os.FileMode) error

WriteMessage marshals pb and atomically writes it into fname.

func WriteTextMessage

func WriteTextMessage(fname string, pb proto.Message, perm os.FileMode) error

WriteTextMessage marshals pb in text format and atomically writes it into fname.

Types

type Store

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

Store represents a persistent protocol buffer message store.

func NewStore

func NewStore(dir string) (*Store, error)

NewStore returns a new Store instance. It will create dir if needed.

func (*Store) Get

func (s *Store) Get(id string, m proto.Message) (bool, error)

Get a message from the store.

func (*Store) ListIDs

func (s *Store) ListIDs() ([]string, error)

ListIDs in the store.

func (*Store) Put

func (s *Store) Put(id string, m proto.Message) error

Put a message into the store.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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