github.com/pyroscope-io/pyroscope@v0.37.3-0.20230725203016-5f6947968bd0/pkg/stackbuilder/stackbuilder.go (about)

     1  package stackbuilder
     2  
     3  import (
     4  	"context"
     5  	"github.com/pyroscope-io/pyroscope/pkg/ingestion"
     6  	"github.com/pyroscope-io/pyroscope/pkg/storage/metadata"
     7  	"github.com/pyroscope-io/pyroscope/pkg/storage/tree"
     8  )
     9  
    10  type SamplesAppender interface {
    11  	Append(stackID, value uint64)
    12  }
    13  
    14  type Label struct{ Key, Value string }
    15  type Labels []Label
    16  
    17  type WriteBatch interface {
    18  	StackBuilder() tree.StackBuilder
    19  	SamplesAppender(startTime, endTime int64, labels Labels) SamplesAppender
    20  	Flush()
    21  }
    22  
    23  type WriteBatchFactory interface {
    24  	NewWriteBatch(appName string, md metadata.Metadata) (WriteBatch, error)
    25  }
    26  
    27  type WriteBatchParser interface {
    28  	ParseWithWriteBatch(c context.Context, wbf WriteBatchFactory, md ingestion.Metadata) error
    29  }