gen

package
v0.7.2 Latest Latest
Warning

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

Go to latest
Published: Feb 20, 2026 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const (
	CTestGenSeed    = 811509576612567777
	CUseTestGenSeed = false
)
View Source
const (
	CEC2CredsType = "ec2"
)

Variables

View Source
var (
	ErrEmptyIterator = errors.New("iterator is empty")
)
View Source
var (
	ErrEmptyQueue = errors.New("queue is empty")
)
View Source
var (
	ErrEmptyStack = errors.New("stack is empty")
)

Functions

func GenerateBucketNameCharacters added in v0.7.1

func GenerateBucketNameCharacters() []rune

func GenerateCommonSafeCharacters added in v0.7.1

func GenerateCommonSafeCharacters() []rune

func GenerateEC2AccessKeyCharacters added in v0.7.1

func GenerateEC2AccessKeyCharacters() []rune

func GenerateEC2SecretKeyCharacters added in v0.7.1

func GenerateEC2SecretKeyCharacters() []rune

func GeneratePasswordCharacters added in v0.7.1

func GeneratePasswordCharacters() []rune

func GenerateS3AvoidCharacters

func GenerateS3AvoidCharacters() []rune

func GenerateS3SafeCharacters

func GenerateS3SafeCharacters() []rune

func GenerateS3SpecialHandlingCharacters

func GenerateS3SpecialHandlingCharacters() []rune

func GenerateUsernameCharacters added in v0.7.1

func GenerateUsernameCharacters() []rune

Types

type BucketNameGenerator added in v0.7.1

type BucketNameGenerator struct {
	NameAlphabet []rune
}

func NewBucketNameGenerator added in v0.7.1

func NewBucketNameGenerator() *BucketNameGenerator

func (*BucketNameGenerator) Generate added in v0.7.1

func (r *BucketNameGenerator) Generate(rnd *Rnd) string

Rules are more complex https://docs.aws.amazon.com/AmazonS3/latest/userguide/bucketnamingrules.html Approaching with easy and safe option

type CommonObjectGenerator added in v0.7.1

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

func NewCommonObjectGenerator added in v0.7.1

func NewCommonObjectGenerator(opts ...CommonObjectGeneratorOptions) *CommonObjectGenerator

func (*CommonObjectGenerator) Generate added in v0.7.1

func (r *CommonObjectGenerator) Generate(rnd *Rnd, nodeType TreeNodeType, parentData *GeneratedObject) (*GeneratedObject, error)

type CommonObjectGeneratorOptions added in v0.7.1

type CommonObjectGeneratorOptions func(gen *CommonObjectGenerator)

func WithContentLengthhRange

func WithContentLengthhRange(min uint32, max uint32) CommonObjectGeneratorOptions

func WithNameCharacters

func WithNameCharacters(chars []rune) CommonObjectGeneratorOptions

func WithNameLengthRange

func WithNameLengthRange(min uint32, max uint32) CommonObjectGeneratorOptions

func WithVersionRange

func WithVersionRange(min uint32, max uint32) CommonObjectGeneratorOptions

func WithVersioned

func WithVersioned() CommonObjectGeneratorOptions

type ContentFiller added in v0.7.1

type ContentFiller interface {
	FillBucket(ctx context.Context, bucket string) error
	FillBucketWithLastVersions(ctx context.Context, bucket string) error
}

type CredentialsGenerator added in v0.7.1

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

func NewCredentialsGenerator added in v0.7.1

func NewCredentialsGenerator(rnd *Rnd) *CredentialsGenerator

func (*CredentialsGenerator) GenerateBucketName added in v0.7.1

func (r *CredentialsGenerator) GenerateBucketName() string

func (*CredentialsGenerator) GenerateEC2Credentials added in v0.7.1

func (r *CredentialsGenerator) GenerateEC2Credentials() *EC2Credentials

func (*CredentialsGenerator) GenerateKeystoneName added in v0.7.1

func (r *CredentialsGenerator) GenerateKeystoneName() string

func (*CredentialsGenerator) GenerateUsernamePassword added in v0.7.1

func (r *CredentialsGenerator) GenerateUsernamePassword() *UsernamePassword

type DepthFirstTreeNodeIterator

type DepthFirstTreeNodeIterator[T any] struct {
	// contains filtered or unexported fields
}

func (*DepthFirstTreeNodeIterator[T]) HasNext

func (r *DepthFirstTreeNodeIterator[T]) HasNext() bool

func (*DepthFirstTreeNodeIterator[T]) Must

func (r *DepthFirstTreeNodeIterator[T]) Must() iter.Seq[*TreeNode[T]]

func (*DepthFirstTreeNodeIterator[T]) Next

func (r *DepthFirstTreeNodeIterator[T]) Next() (*TreeNode[T], error)

type DepthFirstTreeValueIterator

type DepthFirstTreeValueIterator[T any] struct {
	DepthFirstTreeNodeIterator[T]
}

func (*DepthFirstTreeValueIterator[T]) Must

func (r *DepthFirstTreeValueIterator[T]) Must() iter.Seq[T]

func (*DepthFirstTreeValueIterator[T]) Next

func (r *DepthFirstTreeValueIterator[T]) Next() (T, error)

type DummyObjectGenerator

type DummyObjectGenerator[T any] struct{}

func NewDummyObjectGenerator

func NewDummyObjectGenerator[T any]() *DummyObjectGenerator[T]

func (*DummyObjectGenerator[T]) Generate

func (r *DummyObjectGenerator[T]) Generate(_ *Rnd, _ TreeNodeType, _ T) (T, error)

type EC2Credentials added in v0.7.1

type EC2Credentials struct {
	Access string `json:"access"`
	Secret string `json:"secret"`
}

type EC2CredentialsGenerator added in v0.7.1

type EC2CredentialsGenerator struct {
	AccessKeyAlphabet []rune
	SecretKeyAlphabet []rune
}

func NewEC2CredentialsGenerator added in v0.7.1

func NewEC2CredentialsGenerator() *EC2CredentialsGenerator

func (*EC2CredentialsGenerator) Generate added in v0.7.1

func (r *EC2CredentialsGenerator) Generate(rnd *Rnd) *EC2Credentials

type GeneratedObject added in v0.7.1

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

func (*GeneratedObject) ContentReaderIterator added in v0.7.1

func (r *GeneratedObject) ContentReaderIterator() iter.Seq2[uint64, *GeneratedObjectContentReader]

func (*GeneratedObject) GetContentReader added in v0.7.1

func (r *GeneratedObject) GetContentReader() *GeneratedObjectContentReader

func (*GeneratedObject) GetFirstVersionContentReader added in v0.7.1

func (r *GeneratedObject) GetFirstVersionContentReader() *GeneratedObjectContentReader

func (*GeneratedObject) GetFullPath added in v0.7.1

func (r *GeneratedObject) GetFullPath() string

func (*GeneratedObject) GetLastVersionContentReader added in v0.7.1

func (r *GeneratedObject) GetLastVersionContentReader() *GeneratedObjectContentReader

func (*GeneratedObject) GetNodeType added in v0.7.1

func (r *GeneratedObject) GetNodeType() TreeNodeType

func (*GeneratedObject) GetVersionContentReader added in v0.7.1

func (r *GeneratedObject) GetVersionContentReader(versionIdx uint64) *GeneratedObjectContentReader

func (*GeneratedObject) GetVersionCount added in v0.7.1

func (r *GeneratedObject) GetVersionCount() uint64

type GeneratedObjectContentReader added in v0.7.1

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

func NewGeneratedObjectContentReader added in v0.7.1

func NewGeneratedObjectContentReader(seed int64, contentLengthRange *GeneratorRange) *GeneratedObjectContentReader

func (*GeneratedObjectContentReader) Len added in v0.7.1

func (*GeneratedObjectContentReader) Read added in v0.7.1

func (r *GeneratedObjectContentReader) Read(p []byte) (int, error)

type GeneratorRange

type GeneratorRange struct {
	Min int64
	Max int64
}

type KeystoneNameGenerator added in v0.7.1

type KeystoneNameGenerator struct {
	NameAlphabet []rune
}

func NewKeystoneNameGenerator added in v0.7.1

func NewKeystoneNameGenerator() *KeystoneNameGenerator

func (*KeystoneNameGenerator) Generate added in v0.7.1

func (r *KeystoneNameGenerator) Generate(rnd *Rnd) string

type ObjectGenerator

type ObjectGenerator[T any] interface {
	Generate(rnd *Rnd, nodeType TreeNodeType, parentData T) (T, error)
}

type ObjectInfo added in v0.7.1

type ObjectInfo struct {
	LastModified time.Time
	Key          string
	VersionID    string
	Etag         string
	Size         uint64
}

type Queue

type Queue[T any] struct {
	// contains filtered or unexported fields
}

func NewQueue

func NewQueue[T any]() *Queue[T]

func (*Queue[T]) Dequeue

func (r *Queue[T]) Dequeue() (T, error)

func (*Queue[T]) Empty

func (r *Queue[T]) Empty() bool

func (*Queue[T]) Enqueue

func (r *Queue[T]) Enqueue(data T)

func (*Queue[T]) Len

func (r *Queue[T]) Len() uint64

type QueueNode

type QueueNode[T any] struct {
	// contains filtered or unexported fields
}

type Rnd

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

func NewRnd

func NewRnd(seed int64) *Rnd

func (*Rnd) Bool

func (r *Rnd) Bool() bool

func (*Rnd) Int64

func (r *Rnd) Int64() int64

func (*Rnd) Int64InRange

func (r *Rnd) Int64InRange(min int64, max int64) int64

func (*Rnd) IntInRange

func (r *Rnd) IntInRange(min int, max int) int

func (*Rnd) Read

func (r *Rnd) Read(p []byte)

func (*Rnd) StringFromAlphabet

func (r *Rnd) StringFromAlphabet(alphabet string, resultLength int64) string

func (*Rnd) StringFromRunes

func (r *Rnd) StringFromRunes(alphabet []rune, resultLength int64) string

func (*Rnd) VarLengthStringFromAlphabet

func (r *Rnd) VarLengthStringFromAlphabet(alphabet string, minLength int64, maxLength int64) string

func (*Rnd) VarLengthStringFromRunes

func (r *Rnd) VarLengthStringFromRunes(alphabet []rune, minLength int64, maxLength int64) string

type S3Filler

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

func NewS3Filler

func NewS3Filler(tree *Tree[*GeneratedObject], client *minio.Client) *S3Filler

func (*S3Filler) FillBucket added in v0.7.1

func (r *S3Filler) FillBucket(ctx context.Context, bucket string) error

func (*S3Filler) FillBucketWithLastVersions added in v0.7.1

func (r *S3Filler) FillBucketWithLastVersions(ctx context.Context, bucket string) error

type S3Validator

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

func NewS3Validator

func NewS3Validator(tree *Tree[*GeneratedObject], client *minio.Client) *S3Validator

func (*S3Validator) Validator

func (r *S3Validator) Validator(ctx context.Context, bucket string) error

type Stack

type Stack[T any] struct {
	// contains filtered or unexported fields
}

func NewStack

func NewStack[T any]() *Stack[T]

func (*Stack[T]) Empty

func (r *Stack[T]) Empty() bool

func (*Stack[T]) Len

func (r *Stack[T]) Len() uint64

func (*Stack[T]) Peek

func (r *Stack[T]) Peek() (T, error)

func (*Stack[T]) Pop

func (r *Stack[T]) Pop() (T, error)

func (*Stack[T]) Push

func (r *Stack[T]) Push(data T)

type StackNode

type StackNode[T any] struct {
	// contains filtered or unexported fields
}

type SwiftFiller added in v0.7.1

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

func NewSwiftFiller added in v0.7.1

func NewSwiftFiller(tree *Tree[*GeneratedObject], client *gophercloud.ServiceClient) *SwiftFiller

func (*SwiftFiller) FillBucket added in v0.7.1

func (r *SwiftFiller) FillBucket(ctx context.Context, bucket string) error

func (*SwiftFiller) FillBucketWithLastVersions added in v0.7.1

func (r *SwiftFiller) FillBucketWithLastVersions(ctx context.Context, bucket string) error

type SwiftValidator added in v0.7.1

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

func NewSwiftValidator added in v0.7.1

func NewSwiftValidator(tree *Tree[*GeneratedObject], client *gophercloud.ServiceClient) *SwiftValidator

func (*SwiftValidator) Validator added in v0.7.1

func (r *SwiftValidator) Validator(ctx context.Context, bucket string) error

type Tree

type Tree[T any] struct {
	// contains filtered or unexported fields
}

func NewTree

func NewTree[T any](root *TreeNode[T]) *Tree[T]

func (*Tree[T]) DepthFirstNodeIterator

func (r *Tree[T]) DepthFirstNodeIterator() *DepthFirstTreeNodeIterator[T]

func (*Tree[T]) DepthFirstValueIterator

func (r *Tree[T]) DepthFirstValueIterator() *DepthFirstTreeValueIterator[T]

func (*Tree[T]) WidthFirstNodeIterator

func (r *Tree[T]) WidthFirstNodeIterator() *WidthFirstTreeNodeIterator[T]

func (*Tree[T]) WidthFirstValueIterator

func (r *Tree[T]) WidthFirstValueIterator() *WidthFirstTreeValueIterator[T]

type TreeGenerationTask

type TreeGenerationTask[T any] struct {
	// contains filtered or unexported fields
}

type TreeGenerator

type TreeGenerator[T any] struct {
	// contains filtered or unexported fields
}

func NewTreeGenerator

func NewTreeGenerator[T any](opts ...TreeGeneratorOption[T]) (*TreeGenerator[T], error)

func (*TreeGenerator[T]) Generate

func (r *TreeGenerator[T]) Generate() (*Tree[T], error)

type TreeGeneratorOption

type TreeGeneratorOption[T any] interface {
	// contains filtered or unexported methods
}

func WithDepthRange

func WithDepthRange[T any](min uint32, max uint32) TreeGeneratorOption[T]

func WithForceTargetDepth

func WithForceTargetDepth[T any]() TreeGeneratorOption[T]

func WithObjectGenerator

func WithObjectGenerator[T any](generator ObjectGenerator[T]) TreeGeneratorOption[T]

func WithRandomSeed

func WithRandomSeed[T any](seed int64) TreeGeneratorOption[T]

func WithRnd

func WithRnd[T any](rnd *Rnd) TreeGeneratorOption[T]

func WithWidthRange

func WithWidthRange[T any](min uint32, max uint32) TreeGeneratorOption[T]

type TreeGeneratorWithDepthRangeOption

type TreeGeneratorWithDepthRangeOption[T any] struct {
	// contains filtered or unexported fields
}

type TreeGeneratorWithForceTargetDepthOption

type TreeGeneratorWithForceTargetDepthOption[T any] struct{}

type TreeGeneratorWithObjectGeneratorOption

type TreeGeneratorWithObjectGeneratorOption[T any] struct {
	// contains filtered or unexported fields
}

type TreeGeneratorWithRandomSeedOption

type TreeGeneratorWithRandomSeedOption[T any] struct {
	// contains filtered or unexported fields
}

type TreeGeneratorWithRndOption

type TreeGeneratorWithRndOption[T any] struct {
	// contains filtered or unexported fields
}

type TreeGeneratorWithWidthRangeOption

type TreeGeneratorWithWidthRangeOption[T any] struct {
	// contains filtered or unexported fields
}

type TreeNode

type TreeNode[T any] struct {
	// contains filtered or unexported fields
}

func (*TreeNode[T]) Data

func (r *TreeNode[T]) Data() T

type TreeNodeType

type TreeNodeType int
const (
	CRootTreeNodeType TreeNodeType = iota + 1
	CJointTreeNodeType
	CLeafTreeNodeType
)

type TreeRandomElementPicker

type TreeRandomElementPicker[T any] struct {
	// contains filtered or unexported fields
}

func NewTreeRandomElementPicker

func NewTreeRandomElementPicker[T any](tree *Tree[T], rnd *Rnd) *TreeRandomElementPicker[T]

func (*TreeRandomElementPicker[T]) RandomJointNode

func (r *TreeRandomElementPicker[T]) RandomJointNode() *TreeNode[T]

func (*TreeRandomElementPicker[T]) RandomJointSubtree

func (r *TreeRandomElementPicker[T]) RandomJointSubtree() *Tree[T]

func (*TreeRandomElementPicker[T]) RandomJointValue

func (r *TreeRandomElementPicker[T]) RandomJointValue() T

func (*TreeRandomElementPicker[T]) RandomLeafNode

func (r *TreeRandomElementPicker[T]) RandomLeafNode() *TreeNode[T]

func (*TreeRandomElementPicker[T]) RandomLeafValue

func (r *TreeRandomElementPicker[T]) RandomLeafValue() T

func (*TreeRandomElementPicker[T]) RootNode

func (r *TreeRandomElementPicker[T]) RootNode() *TreeNode[T]

func (*TreeRandomElementPicker[T]) RootValue

func (r *TreeRandomElementPicker[T]) RootValue() T

type UsernamePassword added in v0.7.1

type UsernamePassword struct {
	Username string `json:"username"`
	Password string `json:"password"`
}

type UsernamePasswordGenerator added in v0.7.1

type UsernamePasswordGenerator struct {
	UsernameAlphabet []rune
	PasswordAlphabet []rune
}

func NewUsernamePasswordGenerator added in v0.7.1

func NewUsernamePasswordGenerator() *UsernamePasswordGenerator

func (*UsernamePasswordGenerator) Generate added in v0.7.1

func (r *UsernamePasswordGenerator) Generate(rnd *Rnd) *UsernamePassword

type WidthFirstTreeNodeIterator

type WidthFirstTreeNodeIterator[T any] struct {
	// contains filtered or unexported fields
}

func (*WidthFirstTreeNodeIterator[T]) HasNext

func (r *WidthFirstTreeNodeIterator[T]) HasNext() bool

func (*WidthFirstTreeNodeIterator[T]) Must

func (r *WidthFirstTreeNodeIterator[T]) Must() iter.Seq[*TreeNode[T]]

func (*WidthFirstTreeNodeIterator[T]) Next

func (r *WidthFirstTreeNodeIterator[T]) Next() (*TreeNode[T], error)

type WidthFirstTreeValueIterator

type WidthFirstTreeValueIterator[T any] struct {
	WidthFirstTreeNodeIterator[T]
}

func (*WidthFirstTreeValueIterator[T]) Must

func (r *WidthFirstTreeValueIterator[T]) Must() iter.Seq[T]

func (*WidthFirstTreeValueIterator[T]) Next

func (r *WidthFirstTreeValueIterator[T]) Next() (T, error)

Jump to

Keyboard shortcuts

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