First attempt for obiconsensus... The graph traversing algorithm is too simple

Former-commit-id: 0456e6c7fd55d6d0fcf9856c40386b976b912cba
This commit is contained in:
2023-03-27 19:51:10 +07:00
parent d5e84ec676
commit a33e471b39
17 changed files with 868 additions and 23 deletions

View File

@ -10,6 +10,7 @@ type __options__ struct {
with_progress_bar bool
buffer_size int
batch_size int
full_file_batch bool
quality_shift int
parallel_workers int
closefile bool
@ -25,6 +26,7 @@ type __options__ struct {
csv_separator string
csv_navalue string
paired_filename string
source string
}
type Options struct {
@ -42,6 +44,7 @@ func MakeOptions(setters []WithOption) Options {
quality_shift: 33,
parallel_workers: 4,
batch_size: 5000,
full_file_batch: false,
closefile: false,
appendfile: false,
compressed: false,
@ -52,9 +55,10 @@ func MakeOptions(setters []WithOption) Options {
csv_sequence: true,
csv_quality: false,
csv_separator: ",",
csv_navalue: "NA",
csv_navalue: "NA",
csv_keys: make([]string, 0),
paired_filename: "",
source: "",
}
opt := Options{&o}
@ -74,6 +78,10 @@ func (opt Options) BatchSize() int {
return opt.pointer.batch_size
}
func (opt Options) FullFileBatch() bool {
return opt.pointer.full_file_batch
}
func (opt Options) ParallelWorkers() int {
return opt.pointer.parallel_workers
}
@ -146,6 +154,14 @@ func (opt Options) PairedFileName() string {
return opt.pointer.paired_filename
}
func (opt Options) HasSource() bool {
return opt.pointer.source != ""
}
func (opt Options) Source() string {
return opt.pointer.source
}
func OptionCloseFile() WithOption {
f := WithOption(func(opt Options) {
opt.pointer.closefile = true
@ -253,6 +269,22 @@ func OptionsBatchSize(size int) WithOption {
return f
}
func OptionsFullFileBatch(full bool) WithOption {
f := WithOption(func(opt Options) {
opt.pointer.full_file_batch = full
})
return f
}
func OptionsSource(source string) WithOption {
f := WithOption(func(opt Options) {
opt.pointer.source = source
})
return f
}
func OptionsWithProgressBar() WithOption {
f := WithOption(func(opt Options) {
opt.pointer.with_progress_bar = true