minor fixes
This commit is contained in:
@@ -56,10 +56,6 @@ func (s *EventSubgraph) FirstNodeByLabel(label string) *Node {
|
|||||||
// Helpers
|
// Helpers
|
||||||
|
|
||||||
func IsValidTag(t roots.Tag) bool {
|
func IsValidTag(t roots.Tag) bool {
|
||||||
if len(t) < 2 {
|
|
||||||
// Skip tags that do not have name and value fields
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
if len(t[0])+len(t[1]) > 8192 {
|
if len(t[0])+len(t[1]) > 8192 {
|
||||||
// Skip tags that are too large for the neo4j indexer
|
// Skip tags that are too large for the neo4j indexer
|
||||||
return false
|
return false
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ type preparedWrite struct {
|
|||||||
Subgraph *EventSubgraph
|
Subgraph *EventSubgraph
|
||||||
}
|
}
|
||||||
|
|
||||||
type excludedEvent struct {
|
type ExcludedEvent struct {
|
||||||
Event roots.ValidatedEvent
|
Event roots.ValidatedEvent
|
||||||
Reason error
|
Reason error
|
||||||
}
|
}
|
||||||
@@ -32,7 +32,7 @@ type WriteResult struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type WriteReport struct {
|
type WriteReport struct {
|
||||||
ExcludedEvents []excludedEvent
|
ExcludedEvents []ExcludedEvent
|
||||||
CreatedEventCount int
|
CreatedEventCount int
|
||||||
Neo4jResultSummaries []neo4j.ResultSummary
|
Neo4jResultSummaries []neo4j.ResultSummary
|
||||||
Duration time.Duration
|
Duration time.Duration
|
||||||
@@ -81,7 +81,7 @@ func setDefaultWriteOptions(opts *WriteOptions) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func enforcePolicyRules(in []roots.ValidatedEvent, boltdb *bolt.DB, batchSize int) (queued []roots.ValidatedEvent, excluded []excludedEvent) {
|
func enforcePolicyRules(in []roots.ValidatedEvent, boltdb *bolt.DB, batchSize int) (queued []roots.ValidatedEvent, excluded []ExcludedEvent) {
|
||||||
for i := 0; i < len(in); i += batchSize {
|
for i := 0; i < len(in); i += batchSize {
|
||||||
end := i + batchSize
|
end := i + batchSize
|
||||||
if end > len(in) {
|
if end > len(in) {
|
||||||
@@ -98,7 +98,7 @@ func enforcePolicyRules(in []roots.ValidatedEvent, boltdb *bolt.DB, batchSize in
|
|||||||
|
|
||||||
for _, e := range batch {
|
for _, e := range batch {
|
||||||
if existsMap[e.ID()] {
|
if existsMap[e.ID()] {
|
||||||
excluded = append(excluded, excludedEvent{
|
excluded = append(excluded, ExcludedEvent{
|
||||||
Event: e,
|
Event: e,
|
||||||
Reason: fmt.Errorf("skipped: %w", ErrDuplicate),
|
Reason: fmt.Errorf("skipped: %w", ErrDuplicate),
|
||||||
})
|
})
|
||||||
|
|||||||
Reference in New Issue
Block a user