Documentation
¶
Overview ¶
Package documents implements document registration, recovery, and source access.
Index ¶
- type NameMatches
- type Preflight
- type RegisterCommand
- type Service
- func (s *Service) FindNameMatches(ctx context.Context, value string, limit int) (NameMatches, error)
- func (s *Service) GetDocument(ctx context.Context, documentID uuid.UUID) (knowledge.DocumentDetails, error)
- func (s *Service) ListDocuments(ctx context.Context, limit, offset int) ([]knowledge.DocumentSummary, error)
- func (s *Service) Preflight(ctx context.Context, fileName string, content []byte) (Preflight, error)
- func (s *Service) Ready(ctx context.Context) error
- func (s *Service) RecoverRegistration(ctx context.Context, requestKey string) (knowledge.UploadRecovery, error)
- func (s *Service) Register(ctx context.Context, command RegisterCommand) (knowledge.Registration, error)
- func (s *Service) Retry(ctx context.Context, runID uuid.UUID, requestKey string) (uuid.UUID, error)
- func (s *Service) Source(ctx context.Context, documentID uuid.UUID, version int) (Source, error)
- type Source
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type NameMatches ¶
type NameMatches struct {
NormalizedName string
Total int
Documents []knowledge.DocumentSummary
}
NameMatches describes existing Documents whose normalized display name is equal to a proposed name. Matches are guidance only and never block creation.
type Preflight ¶
type Preflight struct {
FileName string
ByteSize int
PageCount int
SHA256 string
SuggestedName string
}
Preflight describes a PDF that passed parser validation without persisting it.
type RegisterCommand ¶
type RegisterCommand struct {
RequestKey string
Operation knowledge.RegistrationOperation
TargetDocumentID *uuid.UUID
DocumentName string
OriginalFileName string
Content []byte
}
RegisterCommand contains the user intent and uploaded PDF for one registration.
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
Service owns document registration and access policy across persistence adapters.
func (*Service) FindNameMatches ¶
func (s *Service) FindNameMatches(ctx context.Context, value string, limit int) (NameMatches, error)
FindNameMatches returns bounded, exact normalized-name matches so callers can distinguish creating a separate Document from adding a Version.
func (*Service) GetDocument ¶
func (s *Service) GetDocument(ctx context.Context, documentID uuid.UUID) (knowledge.DocumentDetails, error)
GetDocument returns document details and version history.
func (*Service) ListDocuments ¶
func (s *Service) ListDocuments(ctx context.Context, limit, offset int) ([]knowledge.DocumentSummary, error)
ListDocuments returns one bounded page of documents.
func (*Service) Preflight ¶
func (s *Service) Preflight(ctx context.Context, fileName string, content []byte) (Preflight, error)
Preflight validates a PDF and returns stable metadata without storing it.
func (*Service) Ready ¶
Ready reports whether every dependency required for document requests is available.
func (*Service) RecoverRegistration ¶
func (s *Service) RecoverRegistration(ctx context.Context, requestKey string) (knowledge.UploadRecovery, error)
RecoverRegistration resolves an idempotent upload request after response loss.
func (*Service) Register ¶
func (s *Service) Register(ctx context.Context, command RegisterCommand) (knowledge.Registration, error)
Register validates and stores a PDF before atomically registering its version. If the database write fails, it removes the object only after proving that no committed version references the content-addressed key.
type Source ¶
type Source struct {
Document knowledge.SourceDocument
Path string
}
Source identifies an immutable document version and its confined local path.