memory

package
v0.2.3 Latest Latest
Warning

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

Go to latest
Published: Dec 17, 2025 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Overview

Package memory provides in-memory implementations of driven ports. These adapters are used for testing and development.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ConfigStore

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

ConfigStore is an in-memory implementation of driven.ConfigStore for testing.

func NewConfigStore

func NewConfigStore() *ConfigStore

NewConfigStore creates a new in-memory config store.

func (*ConfigStore) Get

func (s *ConfigStore) Get(key string) (any, bool)

Get retrieves a configuration value by key.

func (*ConfigStore) GetBool

func (s *ConfigStore) GetBool(key string) bool

GetBool retrieves a boolean configuration value.

func (*ConfigStore) GetInt

func (s *ConfigStore) GetInt(key string) int

GetInt retrieves an integer configuration value.

func (*ConfigStore) GetString

func (s *ConfigStore) GetString(key string) string

GetString retrieves a string configuration value.

func (*ConfigStore) GetStringSlice

func (s *ConfigStore) GetStringSlice(key string) []string

GetStringSlice retrieves a string slice configuration value.

func (*ConfigStore) Load

func (s *ConfigStore) Load() error

Load reads configuration from storage (no-op for memory store).

func (*ConfigStore) Path

func (s *ConfigStore) Path() string

Path returns the configuration file path.

func (*ConfigStore) Save

func (s *ConfigStore) Save() error

Save persists the current configuration (no-op for memory store).

func (*ConfigStore) Set

func (s *ConfigStore) Set(key string, value any) error

Set stores a configuration value.

type DocumentStore

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

DocumentStore is an in-memory implementation of driven.DocumentStore.

func NewDocumentStore

func NewDocumentStore() *DocumentStore

NewDocumentStore creates a new in-memory document store.

func (*DocumentStore) DeleteDocument

func (s *DocumentStore) DeleteDocument(_ context.Context, id string) error

DeleteDocument removes a document and its chunks.

func (*DocumentStore) GetChunk

func (s *DocumentStore) GetChunk(_ context.Context, id string) (*domain.Chunk, error)

GetChunk retrieves a specific chunk by ID.

func (*DocumentStore) GetChunks

func (s *DocumentStore) GetChunks(_ context.Context, documentID string) ([]domain.Chunk, error)

GetChunks retrieves all chunks for a document.

func (*DocumentStore) GetDocument

func (s *DocumentStore) GetDocument(_ context.Context, id string) (*domain.Document, error)

GetDocument retrieves a document by ID.

func (*DocumentStore) ListDocuments

func (s *DocumentStore) ListDocuments(_ context.Context, sourceID string) ([]domain.Document, error)

ListDocuments returns documents for a source.

func (*DocumentStore) SaveChunks

func (s *DocumentStore) SaveChunks(_ context.Context, chunks []domain.Chunk) error

SaveChunks stores chunks for a document.

func (*DocumentStore) SaveDocument

func (s *DocumentStore) SaveDocument(_ context.Context, doc *domain.Document) error

SaveDocument stores or updates a document.

type ExclusionStore

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

ExclusionStore is an in-memory implementation of driven.ExclusionStore.

func NewExclusionStore

func NewExclusionStore() *ExclusionStore

NewExclusionStore creates a new in-memory exclusion store.

func (*ExclusionStore) Add

func (s *ExclusionStore) Add(_ context.Context, exclusion *domain.Exclusion) error

Add creates a new exclusion.

func (*ExclusionStore) GetBySourceID

func (s *ExclusionStore) GetBySourceID(_ context.Context, sourceID string) ([]domain.Exclusion, error)

GetBySourceID returns all exclusions for a source.

func (*ExclusionStore) IsExcluded

func (s *ExclusionStore) IsExcluded(_ context.Context, sourceID, uri string) (bool, error)

IsExcluded checks if a URI is excluded for a source.

func (*ExclusionStore) List

List returns all exclusions.

func (*ExclusionStore) Remove

func (s *ExclusionStore) Remove(_ context.Context, id string) error

Remove deletes an exclusion by ID.

type SourceStore

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

SourceStore is an in-memory implementation of driven.SourceStore.

func NewSourceStore

func NewSourceStore() *SourceStore

NewSourceStore creates a new in-memory source store.

func (*SourceStore) Delete

func (s *SourceStore) Delete(_ context.Context, id string) error

Delete removes a source.

func (*SourceStore) Get

func (s *SourceStore) Get(_ context.Context, id string) (*domain.Source, error)

Get retrieves a source by ID.

func (*SourceStore) List

func (s *SourceStore) List(_ context.Context) ([]domain.Source, error)

List returns all configured sources.

func (*SourceStore) Save

func (s *SourceStore) Save(_ context.Context, source domain.Source) error

Save stores or updates a source.

type SyncStateStore

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

SyncStateStore is an in-memory implementation of driven.SyncStateStore.

func NewSyncStateStore

func NewSyncStateStore() *SyncStateStore

NewSyncStateStore creates a new in-memory sync state store.

func (*SyncStateStore) Delete

func (s *SyncStateStore) Delete(_ context.Context, sourceID string) error

Delete removes sync state for a source.

func (*SyncStateStore) Get

func (s *SyncStateStore) Get(_ context.Context, sourceID string) (*domain.SyncState, error)

Get retrieves sync state for a source.

func (*SyncStateStore) Save

func (s *SyncStateStore) Save(_ context.Context, state domain.SyncState) error

Save stores or updates sync state.

Jump to

Keyboard shortcuts

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