Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
N
nebula
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
exchain
nebula
Commits
7e740c8d
Unverified
Commit
7e740c8d
authored
May 10, 2023
by
Michael de Hoog
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use target size instead of max size, and add target frame count
parent
f3f77875
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
15 additions
and
7 deletions
+15
-7
channel_builder.go
op-batcher/batcher/channel_builder.go
+2
-1
shadow_compressor.go
op-batcher/batcher/shadow_compressor.go
+12
-5
target_size_compressor.go
op-batcher/batcher/target_size_compressor.go
+1
-1
No files found.
op-batcher/batcher/channel_builder.go
View file @
7e740c8d
...
...
@@ -102,7 +102,8 @@ func (cc *ChannelConfig) NewCompressor() (derive.Compressor, error) {
switch
cc
.
CompressorKind
{
case
flags
.
CompressorShadow
:
return
NewShadowCompressor
(
cc
.
MaxFrameSize
,
cc
.
TargetFrameSize
,
cc
.
TargetNumFrames
,
)
default
:
return
NewTargetSizeCompressor
(
...
...
op-batcher/batcher/shadow_compressor.go
View file @
7e740c8d
...
...
@@ -8,8 +8,14 @@ import (
)
type
ShadowCompressor
struct
{
// The maximum byte-size a frame can have.
MaxFrameSize
uint64
// The frame size to target when creating channel frames. When adding new
// data to the shadow compressor causes the buffer size to be greater than
// the target size, the compressor is marked as full.
TargetFrameSize
uint64
// The target number of frames to create in this channel. If the realized
// compression ratio is worse than approxComprRatio, additional leftover
// frame(s) might get created.
TargetNumFrames
int
buf
bytes
.
Buffer
compress
*
zlib
.
Writer
...
...
@@ -20,9 +26,10 @@ type ShadowCompressor struct {
fullErr
error
}
func
NewShadowCompressor
(
maxFrameSize
uint64
)
(
derive
.
Compressor
,
error
)
{
func
NewShadowCompressor
(
targetFrameSize
uint64
,
targetNumFrames
int
)
(
derive
.
Compressor
,
error
)
{
c
:=
&
ShadowCompressor
{
MaxFrameSize
:
maxFrameSize
,
TargetFrameSize
:
targetFrameSize
,
TargetNumFrames
:
targetNumFrames
,
}
var
err
error
...
...
@@ -48,7 +55,7 @@ func (t *ShadowCompressor) Write(p []byte) (int, error) {
if
err
!=
nil
{
return
0
,
err
}
if
uint64
(
t
.
shadowBuf
.
Len
())
>
t
.
MaxFrameSize
{
if
uint64
(
t
.
shadowBuf
.
Len
())
>
t
.
TargetFrameSize
*
uint64
(
t
.
TargetNumFrames
)
{
t
.
fullErr
=
derive
.
CompressorFullErr
return
0
,
t
.
fullErr
}
...
...
op-batcher/batcher/target_size_compressor.go
View file @
7e740c8d
...
...
@@ -8,7 +8,7 @@ import (
)
type
TargetSizeCompressor
struct
{
// The
target number of frames to create per channel
. Note that if the
// The
frame size to target when creating channel frames
. Note that if the
// realized compression ratio is worse than the approximate, more frames may
// actually be created. This also depends on how close TargetFrameSize is to
// MaxFrameSize.
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment