directory

package
v0.0.0-...-302cdf8 Latest Latest
Warning

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

Go to latest
Published: Oct 25, 2023 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ErrEmptyName               = errors.ConstError("name cannot be an empty string")
	ErrNameWithSlash           = errors.ConstError("name cannot contain slashes: '/'")
	ErrNameWithNullByte        = errors.ConstError("name cannot contain null bytes")
	ErrNameWithSelfReference   = errors.ConstError("name cannot be a self reference: '.'")
	ErrNameWithParentReference = errors.ConstError("name cannot be a parent reference: '..'")
	ErrNamesAreNotSorted       = errors.ConstError("names must be lexicographically sorted")
)

Variables

View Source
var (
	DiskBasedStreamConfig = nats.StreamConfig{
		Name: "directory_store",
		Subjects: []string{
			subject.WithPrefix("STORE.DIRECTORY.*"),
		},
		Replicas:          1,
		Discard:           nats.DiscardOld,
		MaxMsgsPerSubject: 1,
		Storage:           nats.FileStorage,
		AllowRollup:       true,
		AllowDirect:       true,
		Compression:       nats.S2Compression,

		RePublish: &nats.RePublish{
			Source:      subject.WithPrefix("STORE.DIRECTORY.*"),
			Destination: subject.WithPrefix("CACHE.DIRECTORY.{{wildcard(1)}}"),
		},
	}

	MemoryBasedStreamConfig = nats.StreamConfig{
		Name: "directory_cache",
		Subjects: []string{
			subject.WithPrefix("CACHE.DIRECTORY.*"),
		},
		Replicas:          1,
		Discard:           nats.DiscardOld,
		MaxBytes:          1024 * 1024 * 128,
		MaxMsgsPerSubject: 1,
		Storage:           nats.MemoryStorage,
		AllowRollup:       true,
		AllowDirect:       true,
	}
)

Functions

func NewDirectoryStore

func NewDirectoryStore(conn *nats.Conn) store.Store

Types

type DirEntry

type DirEntry interface {
	GetName() []byte
}

type Server

type Server struct {
	capb.UnimplementedDirectoryServiceServer
	// contains filtered or unexported fields
}

func NewServer

func NewServer(conn *nats.Conn) (*Server, error)

func (*Server) Get

func (*Server) GetByDigest

func (s *Server) GetByDigest(digest store.Digest, ctx context.Context) (*capb.Directory, error)

func (*Server) Put

Jump to

Keyboard shortcuts

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