expsessions

package
v3.1.12+incompatible Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 29, 2020 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Children

type Children map[string]map[string]*Node

map[node_id]map[subtype]*Node

type DedupStore

type DedupStore interface {
	// MarkAsSent marks the object as sent, if it wasn't already.
	// And returns the bool if it was already sent before.
	// Safe for concurrent use.
	MarkAsSent(obj map[string]interface{}, modelName string) (wasAlreadySent bool, _ error)

	Save() error

	Stats() (new int, dups int)
}

func NewDedupStore

func NewDedupStore(loc string) (DedupStore, error)

type FileWriter

type FileWriter struct {
	// contains filtered or unexported fields
}

func NewFileWriter

func NewFileWriter(modelType string, outputDir string, id ID) *FileWriter

func (*FileWriter) Close

func (s *FileWriter) Close() error

func (*FileWriter) Rollback

func (s *FileWriter) Rollback() error

func (*FileWriter) Write

func (s *FileWriter) Write(logger hclog.Logger, objs []map[string]interface{}) error

type ID

type ID int

ID is the session id

type LastProcessedStore

type LastProcessedStore interface {
	Get(key ...string) interface{}
	Set(value interface{}, key ...string) error
}

LastProcessedStore is the interface for storing last processed information

type Manager

type Manager struct {
	// contains filtered or unexported fields
}

Manager is the struct that manages output sessions.

func New

func New(opts Opts) *Manager

New creates a new manager

func (*Manager) Done

func (s *Manager) Done(id ID, lastProcessed interface{}) error

Done closes the session

func (*Manager) GetModelType

func (s *Manager) GetModelType(id ID) string

GetModelType returnes modelType used for session

func (*Manager) Progress

func (s *Manager) Progress(id ID, current, total int)

func (*Manager) Rollback

func (s *Manager) Rollback(id ID) error

Rollback deletes temp file, and does not update last processed

func (*Manager) Session

func (s *Manager) Session(modelType string, parentSessionID ID, parentObjectID, parentObjectName string) (_ ID, lastProcessed interface{}, _ error)

func (*Manager) SessionFlex

func (s *Manager) SessionFlex(export expin.Export, isTracking bool, name string, parentSessionID ID, parentObjectID, parentObjectName string) (_ ID, lastProcessed interface{}, _ error)

func (*Manager) SessionRoot

func (s *Manager) SessionRoot(export expin.Export, modelType string) (_ ID, lastProcessed interface{}, _ error)

func (*Manager) SessionRootTracking

func (s *Manager) SessionRootTracking(export expin.Export, modelType string) (_ ID, lastProcessed interface{}, _ error)

func (*Manager) SessionTracking

func (s *Manager) SessionTracking(modelType string, parentSessionID ID, parentObjectID, parentObjectName string) (_ ID, lastProcessed interface{}, _ error)

func (*Manager) Write

func (s *Manager) Write(id ID, objs []map[string]interface{}) error

type MockWriter

type MockWriter struct {
	Data   []map[string]interface{}
	Closed bool
}

func NewMockWriter

func NewMockWriter() *MockWriter

func (*MockWriter) Close

func (s *MockWriter) Close() error

func (*MockWriter) Rollback

func (s *MockWriter) Rollback() error

func (*MockWriter) Write

func (s *MockWriter) Write(logger hclog.Logger, objs []map[string]interface{}) error

type MockWriters

type MockWriters struct {
	// contains filtered or unexported fields
}

func NewMockWriters

func NewMockWriters() *MockWriters

func (*MockWriters) Data

func (s *MockWriters) Data() map[string][]map[string]interface{}

func (*MockWriters) DataByModel

func (s *MockWriters) DataByModel(modelName string) (res []map[string]interface{})

func (*MockWriters) NewWriter

func (s *MockWriters) NewWriter(modelName string, id ID) Writer

type NewWriterFunc

type NewWriterFunc func(modelName string, id ID) Writer

type Node

type Node struct {
	Children Children
	Current  int
	Total    int
	Done     bool
}

type Opts

type Opts struct {
	Logger        hclog.Logger
	LastProcessed LastProcessedStore

	NewWriter NewWriterFunc

	SendProgress     SendProgressFunc
	SendProgressDone SendProgressDoneFunc
}

Opts are options for New call

type ProgressLine

type ProgressLine struct {
	Path      string `json:"path"`
	Current   int    `json:"current"`
	Total     int    `json:"total"`
	Done      bool   `json:"done"`
	IsSummary bool   `json:"is_summary"`
}

type ProgressPath

type ProgressPath []ProgressPathComponent

ProgressPath describes the path that is in progress.

Progress path example: organization/pinpoint/repo/test_repo/sourcecode.PullRequest/1

func (ProgressPath) Copy

func (s ProgressPath) Copy() ProgressPath

func (ProgressPath) String

func (s ProgressPath) String() string

func (ProgressPath) StringWithObjectNames

func (s ProgressPath) StringWithObjectNames() string

func (ProgressPath) Strings

func (s ProgressPath) Strings() (res []string)

func (ProgressPath) StringsWithObjectNames

func (s ProgressPath) StringsWithObjectNames() (res []string)

type ProgressPathComponent

type ProgressPathComponent struct {
	// ModelName is set for model sessions
	ModelName string
	// TrackingName is set for tracking sessions
	TrackingName string
	// ObjectName is to describe a specific object in model or tracking session
	ObjectName string
	// ObjectID is to describe a specific object in model or tracking session
	ObjectID string
}

ProgressComponent describes one component of progress path.

type ProgressStatus

type ProgressStatus struct {
	Current   int                        `json:"c,omitempty"`
	Total     int                        `json:"t,omitempty"`
	Done      bool                       `json:"done,omitempty"`
	IsSummary bool                       `json:"summary,omitempty"`
	Nested    map[string]*ProgressStatus `json:"nested,omitempty"`
}

type ProgressTracker

type ProgressTracker struct {
	// contains filtered or unexported fields
}

func NewProgressTracker

func NewProgressTracker() *ProgressTracker

func (*ProgressTracker) Done

func (s *ProgressTracker) Done(path []string)

func (*ProgressTracker) InProgressString

func (s *ProgressTracker) InProgressString() string

func (*ProgressTracker) ProgressLines

func (s *ProgressTracker) ProgressLines(pathSep string, skipDone bool) (res []ProgressLine)

func (*ProgressTracker) ProgressLinesNested

func (s *ProgressTracker) ProgressLinesNested(skipDone bool) *ProgressStatus

func (*ProgressTracker) ProgressLinesNestedMap

func (s *ProgressTracker) ProgressLinesNestedMap(skipDone bool) map[string]interface{}

func (*ProgressTracker) Update

func (s *ProgressTracker) Update(path []string, current, total int)

type SendProgressDoneFunc

type SendProgressDoneFunc func(pp ProgressPath)

type SendProgressFunc

type SendProgressFunc func(pp ProgressPath, current, total int)

type Writer

type Writer interface {
	// Write writes objects to output. Not required to be safe for concurrent use.
	Write(logger hclog.Logger, objs []map[string]interface{}) error
	// Close closes writer.
	Close() error

	Rollback() error
}

type WriterDedup

type WriterDedup struct {
	// contains filtered or unexported fields
}

func NewWriterDedup

func NewWriterDedup(wr Writer, ds DedupStore, modelName string) *WriterDedup

func (*WriterDedup) Close

func (s *WriterDedup) Close() error

func (*WriterDedup) Rollback

func (s *WriterDedup) Rollback() error

func (*WriterDedup) Write

func (s *WriterDedup) Write(logger hclog.Logger, objs []map[string]interface{}) error

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL