diff --git a/core/errs/dispatcher.go b/core/errs/dispatcher.go deleted file mode 100644 index ce57abb..0000000 --- a/core/errs/dispatcher.go +++ /dev/null @@ -1,92 +0,0 @@ -// ============================================================================= -// Active-GO Framework -// Copyright (c) 2025 ActiveThing (https://activething.com) -// Author: Juan V. Navarro juanvnl@activething.com -// ============================================================================= -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. -// -// ============================================================================= -// Date Create 19/05/2025 -// ============================================================================= - -package errs - -import ( - "fmt" - "sync" -) - -type ( - - Dispatcher struct { - mu sync.RWMutex - processors map[string]Processor - formatters map[string]Formatter - bufferSize int - - cacheMu sync.Mutex - cacheEnable map[string]struct{} - formatCache map[string]map[uintptr][]byte - } - - DispatcherFnc func (dispatcher *Dispatcher) error -) - - -func NewDispatcher(options ...DispatcherFnc) (*Dispatcher,error) { - dp := &Dispatcher{ - processors : make(map[string]Processor), - formatters : make(map[string]Formatter), - formatCache: make(map[string]map[uintptr][]byte), - cacheEnable: make(map[string]struct{}), - } - for _,o := range options { - if e := o(dp); e != nil { - return nil,e - } - } - return dp,nil -} - - -func (d *Dispatcher) RegisterProcessor(processor Processor, options ...ProcessorEntryFnc) error { - d.mu.Lock() - defer d.mu.Unlock() - - if processor == nil { - return CreateParamNilErr("processor") - } - if _,ex := d.formatters[processor.FormatterID()]; !ex { - // - //todo create newerror formatter_not_registered - } - if _,ex := d.processors[processor.ID()]; ex { - // - //todo create newerror processor_registered - } - - pe,er := NewProcessorEntry(options...) - if er != nil { - return er - } - d.processors[processor.ID()] = pe - - return nil -} \ No newline at end of file diff --git a/go.work b/go.work deleted file mode 100644 index 634647f..0000000 --- a/go.work +++ /dev/null @@ -1,8 +0,0 @@ -go 1.24 - -use ( - app - core - tests - . -) \ No newline at end of file diff --git a/readme.md b/readme.md new file mode 100644 index 0000000..250bf46 --- /dev/null +++ b/readme.md @@ -0,0 +1,35 @@ +# **GOAT: Go Active Thing Framework** + +![GOAT Logo](/docs/img/goat-logo.png "GOAT") + +## **Bienvenido a GOAT** — **Go Active Thing Framework**. + +GOAT es un framework moderno y potente para el desarrollo de aplicaciones en Go, concebido para afrontar los retos más exigentes de los sistemas distribuidos y concurrentes actuales. Desde su núcleo, está diseñado para ofrecer una experiencia de desarrollo donde la **observabilidad**, la **resiliencia** y el **rendimiento extremo** no son añadidos, sino fundamentos. + +Con GOAT, no solo construyes sistemas que escalan: creas software que **respira con claridad**, **resiste con elegancia** y **corre con velocidad**. Es un framework nacido de la experiencia real en ActiveThing.com, donde lidiar con sistemas complejos es el día a día. GOAT no se limita a seguir buenas prácticas: las redefine con herramientas que van más allá de lo convencional. + +--- + +## **🐐 Filosofía y Principios Fundamentales** + +En el corazón de GOAT está una convicción: la complejidad debe enfrentarse con diseño inteligente, no con capas de parches. Por eso se apoya en cinco pilares esenciales: + +- **Observabilidad sin fisuras:** Transforma errores y logs en datos estructurados y trazables, dándote visibilidad total para detectar, entender y solucionar cualquier anomalía. +- **Resiliencia de fábrica:** Permite construir sistemas que absorben fallos, se adaptan y continúan funcionando con gracia ante lo inesperado. +- **Rendimiento al límite:** Minimiza la presión sobre la memoria y el recolector de basura, alcanzando una eficiencia digna de entornos críticos. +- **Composición flexible:** Ofrece componentes modulares y reutilizables que se adaptan a tu arquitectura, en lugar de imponer una. +- **Claridad sin concesiones:** Favorece patrones idiomáticos de Go, priorizando la legibilidad, el mantenimiento y la colaboración. + +--- + +## **🌟 Módulos Clave** + +GOAT se estructura en módulos especializados que abordan con precisión quirúrgica los aspectos críticos del desarrollo moderno... + +## **📜 Licencia** + +GOAT (Go Active Thing Framework) se distribuye bajo la **Licencia MIT**. Esto significa que tienes la libertad de usar, copiar, modificar, fusionar, publicar, distribuir, sublicenciar y/o vender copias del software, siempre que incluyas el aviso de copyright y el permiso en todas las copias sustanciales. + +¡Esperamos sinceramente que GOAT te ayude a construir aplicaciones Go más **robustas, observables y eficientes**\! + +Copyright (c) 2025 ActiveThing (https://activething.com) diff --git a/app/go.mod b/src/app/go.mod similarity index 100% rename from app/go.mod rename to src/app/go.mod diff --git a/app/main.go b/src/app/main.go similarity index 100% rename from app/main.go rename to src/app/main.go diff --git a/core/errs/a.go b/src/core/errs/a.go similarity index 98% rename from core/errs/a.go rename to src/core/errs/a.go index 529c5f0..b307ce5 100644 --- a/core/errs/a.go +++ b/src/core/errs/a.go @@ -100,9 +100,9 @@ var ( // InvalidNilCause indicates that a nil cause was provided where not allowed. InvalidNilCause Err }{ - Multiple: Err(moduleName + "multiple_errors"), + Multiple: Err(moduleName + "multiple_errors"), InvalidErrValue: Err(moduleName + "invalid_err_name"), - InvalidClass: Err(moduleName + "invalid_class"), + InvalidClass: Err(moduleName + "invalid_class"), InvalidNilError: Err(moduleName + "invalid_nil_error"), InvalidMetaName: Err(moduleName + "invalid_meta_name"), InvalidMetaType: Err(moduleName + "invalid_meta_type"), diff --git a/core/errs/causer.go b/src/core/errs/causer.go similarity index 100% rename from core/errs/causer.go rename to src/core/errs/causer.go diff --git a/core/errs/causers.go b/src/core/errs/causers.go similarity index 100% rename from core/errs/causers.go rename to src/core/errs/causers.go diff --git a/core/errs/composer.go b/src/core/errs/composer.go similarity index 100% rename from core/errs/composer.go rename to src/core/errs/composer.go diff --git a/core/errs/err.go b/src/core/errs/err.go similarity index 100% rename from core/errs/err.go rename to src/core/errs/err.go diff --git a/core/errs/error_list.go b/src/core/errs/error_list.go similarity index 100% rename from core/errs/error_list.go rename to src/core/errs/error_list.go diff --git a/core/errs/error_with_cause.go b/src/core/errs/error_with_cause.go similarity index 100% rename from core/errs/error_with_cause.go rename to src/core/errs/error_with_cause.go diff --git a/core/errs/error_with_causes.go b/src/core/errs/error_with_causes.go similarity index 99% rename from core/errs/error_with_causes.go rename to src/core/errs/error_with_causes.go index 72113d6..52491ac 100644 --- a/core/errs/error_with_causes.go +++ b/src/core/errs/error_with_causes.go @@ -34,7 +34,7 @@ type ( // ErrorWithCauses is a type that wraps an error and associates it with multiple underlying causes. // This is useful for aggregating errors from parallel operations. ErrorWithCauses struct { - error // The wrapped error + error // The wrapped error causes ErrorList // The list of underlying errors that caused the wrapped error } ) diff --git a/core/errs/error_with_code.go b/src/core/errs/error_with_code.go similarity index 100% rename from core/errs/error_with_code.go rename to src/core/errs/error_with_code.go diff --git a/core/errs/error_with_date.go b/src/core/errs/error_with_date.go similarity index 100% rename from core/errs/error_with_date.go rename to src/core/errs/error_with_date.go diff --git a/core/errs/error_with_info.go b/src/core/errs/error_with_info.go similarity index 100% rename from core/errs/error_with_info.go rename to src/core/errs/error_with_info.go diff --git a/core/errs/error_with_message.go b/src/core/errs/error_with_message.go similarity index 100% rename from core/errs/error_with_message.go rename to src/core/errs/error_with_message.go diff --git a/core/errs/error_with_meta.go b/src/core/errs/error_with_meta.go similarity index 100% rename from core/errs/error_with_meta.go rename to src/core/errs/error_with_meta.go diff --git a/core/errs/error_with_metas.go b/src/core/errs/error_with_metas.go similarity index 97% rename from core/errs/error_with_metas.go rename to src/core/errs/error_with_metas.go index 0b05841..6ad3d6e 100644 --- a/core/errs/error_with_metas.go +++ b/src/core/errs/error_with_metas.go @@ -33,9 +33,9 @@ import "fmt" // ErrorWithMetas is a type that wraps an error and associates it with multiple arbitrary metadata items. // This is a more general way to add context compared to specific ErrorWithX types. type ErrorWithMetas struct { - error // The wrapped error + error // The wrapped error types MetaSelector // A selector indicating the types of metas stored in this error - metas []Meta // The slice of metadata items + metas []Meta // The slice of metadata items } // WithMetas creates a Composer that adds multiple metadata items to an error. diff --git a/core/errs/error_with_observed_by.go b/src/core/errs/error_with_observed_by.go similarity index 100% rename from core/errs/error_with_observed_by.go rename to src/core/errs/error_with_observed_by.go diff --git a/core/errs/error_with_origin.go b/src/core/errs/error_with_origin.go similarity index 100% rename from core/errs/error_with_origin.go rename to src/core/errs/error_with_origin.go diff --git a/core/errs/error_with_retryable.go b/src/core/errs/error_with_retryable.go similarity index 100% rename from core/errs/error_with_retryable.go rename to src/core/errs/error_with_retryable.go diff --git a/core/errs/error_with_severity.go b/src/core/errs/error_with_severity.go similarity index 98% rename from core/errs/error_with_severity.go rename to src/core/errs/error_with_severity.go index 1ec4b29..db23888 100644 --- a/core/errs/error_with_severity.go +++ b/src/core/errs/error_with_severity.go @@ -33,7 +33,7 @@ import "fmt" // ErrorWithSeverity is a type that wraps an error and adds a Severity level. // This allows classifying the importance of an error. type ErrorWithSeverity struct { - error // The wrapped error + error // The wrapped error severity Severity // The severity level of the error } diff --git a/core/errs/error_with_stack.go b/src/core/errs/error_with_stack.go similarity index 98% rename from core/errs/error_with_stack.go rename to src/core/errs/error_with_stack.go index 80d18a7..ddd24a4 100644 --- a/core/errs/error_with_stack.go +++ b/src/core/errs/error_with_stack.go @@ -37,7 +37,7 @@ type ( // ErrorWithStack is a type that wraps an error and adds a stack trace. // This helps pinpoint the location in the code where the error was created or composed. ErrorWithStack struct { - error // The wrapped error + error // The wrapped error stack excs.Stack // The captured stack trace } ) diff --git a/core/errs/error_with_user.go b/src/core/errs/error_with_user.go similarity index 100% rename from core/errs/error_with_user.go rename to src/core/errs/error_with_user.go diff --git a/core/errs/format.go b/src/core/errs/format.go similarity index 98% rename from core/errs/format.go rename to src/core/errs/format.go index 9275899..c3cc9e6 100644 --- a/core/errs/format.go +++ b/src/core/errs/format.go @@ -53,7 +53,7 @@ func defaultFormatError(w io.Writer, err error, opts *FormatOptions, level int, return } - var el []error // Slice to collect wrapped errors (causes) for recursive formatting + var el []error // Slice to collect wrapped errors (causes) for recursive formatting var stack *Meta // Pointer to store the stack trace metadata if found // Determine which metadata to select based on show options. diff --git a/core/errs/format_options.go b/src/core/errs/format_options.go similarity index 100% rename from core/errs/format_options.go rename to src/core/errs/format_options.go diff --git a/core/errs/format_show.go b/src/core/errs/format_show.go similarity index 100% rename from core/errs/format_show.go rename to src/core/errs/format_show.go diff --git a/core/errs/formatter.go b/src/core/errs/formatter.go similarity index 95% rename from core/errs/formatter.go rename to src/core/errs/formatter.go index 0cc14c8..8deeb1b 100644 --- a/core/errs/formatter.go +++ b/src/core/errs/formatter.go @@ -41,7 +41,7 @@ type ( -func (f FormatFnc) Format (err error) ([]byte,error) { return f(err) } +func (f FormatFnc) Format (err error) ([]byte,error) { return f(err) } diff --git a/core/errs/meta.go b/src/core/errs/meta.go similarity index 95% rename from core/errs/meta.go rename to src/core/errs/meta.go index a5aa287..c601d72 100644 --- a/core/errs/meta.go +++ b/src/core/errs/meta.go @@ -26,8 +26,8 @@ type ( // Meta represents a single piece of metadata associated with an error. // It consists of a name (key), a value, and a type. Meta struct { - name string // The name or key of the metadata (e.g., "userId", "fileName") - value any // The value associated with the metadata (can be of any type) + name string // The name or key of the metadata (e.g., "userId", "fileName") + value any // The value associated with the metadata (can be of any type) mType MetaType // The type of the metadata value } ) diff --git a/core/errs/meta_selector.go b/src/core/errs/meta_selector.go similarity index 100% rename from core/errs/meta_selector.go rename to src/core/errs/meta_selector.go diff --git a/core/errs/meta_type.go b/src/core/errs/meta_type.go similarity index 83% rename from core/errs/meta_type.go rename to src/core/errs/meta_type.go index 7db87b5..a847720 100644 --- a/core/errs/meta_type.go +++ b/src/core/errs/meta_type.go @@ -30,15 +30,15 @@ package errs const ( // Scalar Types - MetaTypeAny MetaType = iota // 0 - Any type (fallback) - MetaTypeString // UTF-8 string - MetaTypeInt // Signed integer (64-bit) - MetaTypeUInt // Unsigned integer (64-bit) - MetaTypeFloat // Floating-point number (64-bit) - MetaTypeBool // Boolean - MetaTypeBytes // Arbitrary binary data (base64 in serialization) - MetaTypeTime // Time (RFC3339 / Unix) - MetaTypeDuration // Duration + MetaTypeAny MetaType = iota // 0 - Any type (fallback) + MetaTypeString // UTF-8 string + MetaTypeInt // Signed integer (64-bit) + MetaTypeUInt // Unsigned integer (64-bit) + MetaTypeFloat // Floating-point number (64-bit) + MetaTypeBool // Boolean + MetaTypeBytes // Arbitrary binary data (base64 in serialization) + MetaTypeTime // Time (RFC3339 / Unix) + MetaTypeDuration // Duration // Composite Types MetaTypeList // Ordered list of elements diff --git a/core/errs/metadata_provider.go b/src/core/errs/metadata_provider.go similarity index 100% rename from core/errs/metadata_provider.go rename to src/core/errs/metadata_provider.go diff --git a/core/errs/panic_err.go b/src/core/errs/panic_err.go similarity index 91% rename from core/errs/panic_err.go rename to src/core/errs/panic_err.go index 7da7b57..3dd7c0f 100644 --- a/core/errs/panic_err.go +++ b/src/core/errs/panic_err.go @@ -37,7 +37,7 @@ type ( // PanicErr is an error type that wraps a recovered panic. // It allows treating a panic as a structured error. PanicErr struct { - Err // Embeds the Err type to inherit its methods and basic structure. + Err // Embeds the Err type to inherit its methods and basic structure. cause error // cause stores the recovered panic value, converted to an error type. } ) @@ -46,8 +46,8 @@ type ( // It converts the panic value to an error type using ToError. func CreatePanicErr(cause any) PanicErr { return PanicErr{ - Err: CreateErr(errPanic), // Creates a base error with the "panic" class. - cause: ToError(cause), // Converts the panic value to an error. + Err: CreateErr(errPanic), // Creates a base error with the "panic" class. + cause: ToError(cause), // Converts the panic value to an error. } } diff --git a/core/errs/param_err.go b/src/core/errs/param_err.go similarity index 100% rename from core/errs/param_err.go rename to src/core/errs/param_err.go diff --git a/core/errs/readme.md b/src/core/errs/readme.md similarity index 100% rename from core/errs/readme.md rename to src/core/errs/readme.md diff --git a/core/errs/severity.go b/src/core/errs/severity.go similarity index 100% rename from core/errs/severity.go rename to src/core/errs/severity.go diff --git a/core/excs/stack.go b/src/core/excs/stack.go similarity index 100% rename from core/excs/stack.go rename to src/core/excs/stack.go diff --git a/core/excs/stack_frame.go b/src/core/excs/stack_frame.go similarity index 100% rename from core/excs/stack_frame.go rename to src/core/excs/stack_frame.go diff --git a/core/go.mod b/src/core/go.mod similarity index 100% rename from core/go.mod rename to src/core/go.mod diff --git a/src/core/logs/dispatcher.go b/src/core/logs/dispatcher.go new file mode 100644 index 0000000..4d710a6 --- /dev/null +++ b/src/core/logs/dispatcher.go @@ -0,0 +1,203 @@ +// ============================================================================= +// Active-GO Framework +// Copyright (c) 2025 ActiveThing (https://activething.com) +// Author: Juan V. Navarro juanvnl@activething.com +// ============================================================================= +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. +// +// ============================================================================= +// Date Create 19/05/2025 +// ============================================================================= + +package logs + +import ( + "context" + "core/errs" + "fmt" + "reflect" + "sync" +) + +type ( + + Dispatcher struct { + mu sync.RWMutex + processors map[string]*ProcessorEntry + formatters map[string]errs.Formatter + bufferSize int + + cacheMu sync.Mutex + cacheEnabled map[string]struct{} + formatCache map[string]map[uintptr][]byte + + inputChan chan error + ctx context.Context + cancel context.CancelFunc + wg sync.WaitGroup + } + + DispatcherFnc func (dispatcher *Dispatcher) error +) + + +func NewDispatcher(options ...DispatcherFnc) (*Dispatcher,error) { + dp := &Dispatcher{ + processors : make(map[string]*ProcessorEntry), + formatters : make(map[string]errs.Formatter), + formatCache: make(map[string]map[uintptr][]byte), + cacheEnabled: make(map[string]struct{}), + + inputChan : make(chan error,100), + } + for _,o := range options { + if e := o(dp); e != nil { + return nil,e + } + } + return dp,nil +} + + +func (d *Dispatcher) Start () { + d.mu.Lock() + defer d.mu.Unlock() + + if d.ctx != nil { + //todo + //panic dispatcher already started + } + + d.ctx,d.cancel = context.WithCancel(context.Background()) + d.wg.Add(1) + go d.run() + + for _,entry := range d.processors { + d.wg.Add(1) + go d.processErrors(d.ctx, entry) + } +} + + + + + +func (d *Dispatcher) RegisterProcessor(processor Processor, options ...ProcessorEntryFnc) error { + d.mu.Lock() + defer d.mu.Unlock() + + if processor == nil { + return errs.CreateParamNilErr("processor") + } + if _,ex := d.formatters[processor.FormatterID()]; !ex { + // + //todo create newerror formatter_not_registered + } + if _,ex := d.processors[processor.ID()]; ex { + // + //todo create newerror processor_registered + } + + pe,er := NewProcessorEntry(options...) + if er != nil { + return er + } + d.processors[processor.ID()] = pe + + return nil +} + + +func (d *Dispatcher) processErrors (entry *ProcessorEntry) { + defer d.wg.Done() + + for { + + select { + case <- d.ctx.Done(): + // todo existing + // + case er,ok := <-entry.channel: + if !ok { + // channel closed + return + } + fi := entry.Processor.FormatterID() + + } + } +} + + + +// getFormattedError retrieves the formatted error from the cache or formats it if not found. +// It uses the dispatcher's formatters and cache. +// This function is called by the processor's dedicated goroutine. +func (d *Dispatcher) getFormattedError(err error, formatterID string) ([]byte, error) { + // Use the error's underlying value's pointer address as a unique identifier for this specific error instance. + // This is the correct and idiomatic way to get a stable ID for caching error instances. + errID := reflect.ValueOf(err).Pointer() // Using reflect.ValueOf().Pointer() for errID + + // Check if caching is enabled for this formatter ID. + d.mu.RLock() // Use RLock to check cacheEnabled map + _, cachingEnabled := d.cacheEnabled[formatterID] + d.mu.RUnlock() // Release RLock + + if cachingEnabled { + d.cacheMu.Lock() // Acquire cache lock to read from cache + // Check if the formatted error is already in the cache for this formatter ID and error. + if formatterCache, ok := d.formatCache[formatterID]; ok { + if formatted, ok := formatterCache[errID]; ok { + d.cacheMu.Unlock() // Release cache lock before returning + return formatted, nil // Found in cache + } + } + d.cacheMu.Unlock() // Release cache lock before accessing formatters (which require d.mu) + } + + // Formatted error not in cache or caching is disabled, find the formatter and format it. + d.mu.RLock() // Need RLock to access the formatters map + formatter, exists := d.formatters[formatterID] + d.mu.RUnlock() // Release RLock + + if !exists { + // This should ideally not happen if RegisterProcessor checks were sufficient, + // but handle defensively. + return nil, fmt.Errorf("formatter with ID '%s' not found", formatterID) + } + + // Format the error using the found formatter. + formatted, formatErr := formatter.Format(err) + if formatErr != nil { + return nil, fmt.Errorf("failed to format error using formatter '%s': %w", formatterID, formatErr) + } + + // Store the formatted error in the cache only if caching is enabled for this formatter. + if cachingEnabled { + d.cacheMu.Lock() // Acquire cache lock to write to cache + if _, ok := d.formatCache[formatterID]; !ok { + d.formatCache[formatterID] = make(map[uintptr][]byte) + } + d.formatCache[formatterID][errID] = formatted + d.cacheMu.Unlock() // Release cache lock after writing to cache + } + + return formatted, nil +} \ No newline at end of file diff --git a/core/errs/processor.go b/src/core/logs/processor.go similarity index 99% rename from core/errs/processor.go rename to src/core/logs/processor.go index 5adf298..86382e1 100644 --- a/core/errs/processor.go +++ b/src/core/logs/processor.go @@ -26,7 +26,7 @@ // Date Create 19/05/2025 // ============================================================================= -package errs +package logs type ( diff --git a/core/errs/processor_entry.go b/src/core/logs/processor_entry.go similarity index 92% rename from core/errs/processor_entry.go rename to src/core/logs/processor_entry.go index 8cc758e..655b430 100644 --- a/core/errs/processor_entry.go +++ b/src/core/logs/processor_entry.go @@ -26,17 +26,17 @@ // Date Create 20/05/2025 // ============================================================================= -package errs +package logs import "time" type ( - ProcessorEntry struct { - processor Processor - channel chan error - state ProcessorState - failures int + ProcessorEntry struct { + Processor + channel chan error + state ProcessorState + failures int maxFailures int blockedTime time.Time blockTime time.Time @@ -48,7 +48,7 @@ type ( func NewProcessorEntry (options...ProcessorEntryFnc) (*ProcessorEntry,error) { - pe := &ProcessorEntry { + pe := &ProcessorEntry{ } return pe,nil diff --git a/core/errs/processor_state.go b/src/core/logs/processor_state.go similarity index 99% rename from core/errs/processor_state.go rename to src/core/logs/processor_state.go index 3991650..62f2371 100644 --- a/core/errs/processor_state.go +++ b/src/core/logs/processor_state.go @@ -26,7 +26,7 @@ // Date Create 19/05/2025 // ============================================================================= -package errs +package logs diff --git a/go.mod b/src/go.mod similarity index 100% rename from go.mod rename to src/go.mod diff --git a/src/go.work b/src/go.work new file mode 100644 index 0000000..04c7b54 --- /dev/null +++ b/src/go.work @@ -0,0 +1,8 @@ +go 1.24 + +use ( + ./app + ./src/core + ./src/tests + . +) \ No newline at end of file diff --git a/tests/f_benchmark_test.go b/src/tests/f_benchmark_test.go similarity index 100% rename from tests/f_benchmark_test.go rename to src/tests/f_benchmark_test.go diff --git a/tests/go.mod b/src/tests/go.mod similarity index 100% rename from tests/go.mod rename to src/tests/go.mod