Full Mattermost server source with integrated Community Enterprise features. Includes vendor directory for offline/air-gapped builds. Structure: - enterprise-impl/: Enterprise feature implementations - enterprise-community/: Init files that register implementations - enterprise/: Bridge imports (community_imports.go) - vendor/: All dependencies for offline builds Build (online): go build ./cmd/mattermost Build (offline/air-gapped): go build -mod=vendor ./cmd/mattermost 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
56 lines
1.4 KiB
Go
56 lines
1.4 KiB
Go
package strategy
|
|
|
|
import (
|
|
"time"
|
|
|
|
"github.com/splitio/go-split-commons/v7/dtos"
|
|
)
|
|
|
|
// NoneImpl struct for none impression mode strategy.
|
|
type NoneImpl struct {
|
|
impressionsCounter *ImpressionsCounter
|
|
uniqueKeysTracker UniqueKeysTracker
|
|
listenerEnabled bool
|
|
}
|
|
|
|
// NewNoneImpl creates new NoneImpl.
|
|
func NewNoneImpl(impressionCounter *ImpressionsCounter, uniqueKeysTracker UniqueKeysTracker, listenerEnabled bool) *NoneImpl {
|
|
return &NoneImpl{
|
|
impressionsCounter: impressionCounter,
|
|
uniqueKeysTracker: uniqueKeysTracker,
|
|
listenerEnabled: listenerEnabled,
|
|
}
|
|
}
|
|
|
|
func (s *NoneImpl) apply(impression *dtos.Impression, now int64) bool {
|
|
s.impressionsCounter.Inc(impression.FeatureName, now, 1)
|
|
s.uniqueKeysTracker.Track(impression.FeatureName, impression.KeyName)
|
|
|
|
return false
|
|
}
|
|
|
|
// Apply track the total amount of evaluations and the unique keys.
|
|
func (s *NoneImpl) Apply(impressions []dtos.Impression) ([]dtos.Impression, []dtos.Impression) {
|
|
now := time.Now().UTC().UnixNano()
|
|
forListener := make([]dtos.Impression, 0, len(impressions))
|
|
|
|
for index := range impressions {
|
|
s.apply(&impressions[index], now)
|
|
}
|
|
|
|
if s.listenerEnabled {
|
|
forListener = impressions
|
|
}
|
|
|
|
return make([]dtos.Impression, 0, 0), forListener
|
|
}
|
|
|
|
// ApplySingle description
|
|
func (s *NoneImpl) ApplySingle(impression *dtos.Impression) bool {
|
|
now := time.Now().UTC().UnixNano()
|
|
|
|
return s.apply(impression, now)
|
|
}
|
|
|
|
var _ ProcessStrategyInterface = (*NoneImpl)(nil)
|