diff options
| author | Paul Buetow <paul@buetow.org> | 2025-06-19 21:53:28 +0300 |
|---|---|---|
| committer | Paul Buetow <paul@buetow.org> | 2025-06-19 21:53:28 +0300 |
| commit | 7ff8beef11fa664d5d07c8701935553046640b99 (patch) | |
| tree | a43b271b2b64275854e558a651c2d357f081c486 /internal/clients/catclient.go | |
| parent | 978437895ef202bf3fc2703b01e5583e12e2a174 (diff) | |
Add comprehensive documentation across DTail codebase
Documented all major Go packages and command-line tools with comprehensive
comments explaining functionality, architecture, and usage patterns.
Major documentation additions:
- All cmd/ binaries with detailed package descriptions and main function docs
- Core internal packages: config, protocol, clients, server, mapr, discovery
- File system operations, error handling, and version management
- Complete API documentation for all public interfaces
- Architecture insights and component relationships
Benefits:
- Improved developer onboarding and maintainability
- Clear understanding of distributed architecture
- Proper Go documentation format for godoc compatibility
- Enhanced troubleshooting through error categorization
- Comprehensive API reference for all client types
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
Diffstat (limited to 'internal/clients/catclient.go')
| -rw-r--r-- | internal/clients/catclient.go | 34 |
1 files changed, 32 insertions, 2 deletions
diff --git a/internal/clients/catclient.go b/internal/clients/catclient.go index 39f56d6..bb08302 100644 --- a/internal/clients/catclient.go +++ b/internal/clients/catclient.go @@ -7,12 +7,42 @@ import ( "github.com/mimecast/dtail/internal/omode" ) -// CatClient is a client for returning a whole file from the beginning to the end. +// CatClient provides distributed file reading functionality, retrieving complete +// file contents from beginning to end across multiple servers simultaneously. +// Unlike TailClient which monitors for new content, CatClient reads existing +// file contents and terminates when complete. +// +// Key features: +// - Simultaneous reading of files across multiple servers +// - Complete file content retrieval from start to finish +// - No regex filtering support (files are read in their entirety) +// - Immediate termination after reading (no continuous monitoring) +// - Efficient handling of large files through streaming +// +// CatClient embeds CommonClient to inherit standard connection management, +// SSH authentication, and command generation capabilities. type CatClient struct { CommonClient } -// NewCatClient returns a new cat client. +// NewCatClient creates a new CatClient configured for distributed file reading. +// This constructor validates the configuration and sets up the client for +// one-time file content retrieval operations. +// +// Parameters: +// args: Complete configuration arguments including servers, files, and options +// +// Returns: +// *CatClient: Configured client ready to start file reading operations +// error: Configuration error if regex is specified (not supported for cat operations) +// +// Configuration validation: +// - Ensures no regex pattern is specified (cat reads entire files) +// - Sets operating mode to CatClient +// - Disables automatic connection retry (one-time operation) +// - Initializes connections to all discovered servers +// +// The returned client is fully initialized and ready to call Start(). func NewCatClient(args config.Args) (*CatClient, error) { if args.RegexStr != "" { return nil, errors.New("Can't use regex with 'cat' operating mode") |
