Skip to content

Commit

Permalink
feat: Provide an option to disable MiniSEED compression
Browse files Browse the repository at this point in the history
  • Loading branch information
bclswl0827 committed Dec 14, 2024
1 parent 9ff4ced commit 6e6e17a
Show file tree
Hide file tree
Showing 9 changed files with 32 additions and 10 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@

Starting from v2.2.5, all notable changes to this project will be documented in this file.

## v3.5.0

### New Features

- Provide an option to disable MiniSEED compression.

## v3.4.6

### Bug Fixes
Expand Down
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
v3.4.6
v3.5.0
8 changes: 5 additions & 3 deletions build/assets/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@
"frequency": 4.5,
"sensitivity": 28.8,
"velocity": true,
"vref": 5.0,
"fullscale": 10.0,
"vref": 2.5,
"fullscale": 5.0,
"resolution": 32
},
"stream_settings": {
Expand Down Expand Up @@ -63,6 +63,7 @@
"miniseed": {
"enable": true,
"lifecycle": 10,
"nocompress": false,
"path": "/home/user/miniseed"
},
"archiver": {
Expand All @@ -77,7 +78,8 @@
"seedlink": {
"enable": true,
"host": "0.0.0.0",
"port": 18000
"port": 18000,
"nocompress": false
},
"helicorder": {
"enable": true,
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ require (
github.com/bclswl0827/heligo v0.0.12
github.com/bclswl0827/mseedio v1.0.10
github.com/bclswl0827/sacio v1.0.6
github.com/bclswl0827/slgo v0.0.4
github.com/bclswl0827/slgo v0.1.0
github.com/bclswl0827/sqlite v1.11.1-0.20240613172512-9e6ac9861470
github.com/beevik/ntp v1.4.3
github.com/bwmarrin/snowflake v0.3.0
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,8 @@ github.com/bclswl0827/mseedio v1.0.10 h1:415K2mJCVqAUeuCfTxOuf5tnUVKfptGokroAlM7
github.com/bclswl0827/mseedio v1.0.10/go.mod h1:G9nOPR8epxb7ihX5pUpvs3HqYZMnMlXc1Ha1WSMWn7s=
github.com/bclswl0827/sacio v1.0.6 h1:kR6ll6xjoQGO+YVEZvvvbAxKGUD3qUXsyIuQape1+vc=
github.com/bclswl0827/sacio v1.0.6/go.mod h1:SuiIK7hBHCJvxUOC/rgbJRUO5IoFrEnuCY0xVJ7RyQk=
github.com/bclswl0827/slgo v0.0.4 h1:WJn0kkQTsGaVJYPnIdDwRgHyEN6FdkIbvBDPxCGk6nU=
github.com/bclswl0827/slgo v0.0.4/go.mod h1:HlY9zJp3ZxqeS66SoRcnwE/c92Mh4d9Jpeat/68yZhs=
github.com/bclswl0827/slgo v0.1.0 h1:ndEOFi/3sx56i5AKvex6hSmhvwG8wP2KnwhVFlbpzQ4=
github.com/bclswl0827/slgo v0.1.0/go.mod h1:HlY9zJp3ZxqeS66SoRcnwE/c92Mh4d9Jpeat/68yZhs=
github.com/bclswl0827/sqlite v1.11.1-0.20240613172512-9e6ac9861470 h1:VYRieWhizTvSnQ3iJ9cVvB+4go+f/2mTp6CC2MSXnn4=
github.com/bclswl0827/sqlite v1.11.1-0.20240613172512-9e6ac9861470/go.mod h1:/xElCFPGgTMHBhfSjGBlITMQ/qe6CLTinWdxSbc4oDE=
github.com/beevik/ntp v1.4.3 h1:PlbTvE5NNy4QHmA4Mg57n7mcFTmr1W1j3gcK7L1lqho=
Expand Down
6 changes: 6 additions & 0 deletions services/miniseed/start.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,12 @@ func (m *MiniSeedService) Start(options *services.Options, waitGroup *sync.WaitG
}
m.basePath = basePath.(string)

noCompress, err := options.Config.Services.GetValue(m.GetServiceName(), "nocompress", "bool")
if err != nil {
noCompress = false
}
m.noCompress = noCompress.(bool)

m.stationCode = options.Config.Stream.Station
m.networkCode = options.Config.Stream.Network
m.locationCode = options.Config.Stream.Location
Expand Down
2 changes: 1 addition & 1 deletion services/miniseed/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import (

const (
MINISEED_BIT_ORDER = mseedio.MSBFIRST
MINISEED_ENCODE_TYPE = mseedio.STEIM2
MINISEED_WRITE_INTERVAL = 5
MINISEED_CLEANUP_INTERVAL = 3600
)
Expand All @@ -19,6 +18,7 @@ type MiniSeedService struct {
writeBufferCountDown int
cleanUpCountDown int
lifeCycle int
noCompress bool
basePath string
stationCode string
networkCode string
Expand Down
6 changes: 5 additions & 1 deletion services/miniseed/write.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,10 @@ func (m *MiniSeedService) handleWrite() error {
}

// Write data to file by channels
encodeType := mseedio.STEIM2
if m.noCompress {
encodeType = mseedio.INT32
}
for _, channelCode := range []string{
explorer.EXPLORER_CHANNEL_CODE_Z,
explorer.EXPLORER_CHANNEL_CODE_E,
Expand All @@ -50,7 +54,7 @@ func (m *MiniSeedService) handleWrite() error {
}
}
var miniseed mseedio.MiniSeedData
err := miniseed.Init(MINISEED_ENCODE_TYPE, MINISEED_BIT_ORDER)
err := miniseed.Init(encodeType, MINISEED_BIT_ORDER)
if err != nil {
return err
}
Expand Down
6 changes: 5 additions & 1 deletion services/seedlink/start.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,10 @@ func (s *SeedLinkService) Start(options *services.Options, waitGroup *sync.WaitG
logger.GetLogger(s.GetServiceName()).Errorln(err)
return
}
noCompress, err := options.Config.Services.GetValue(s.GetServiceName(), "nocompress", "bool")
if err != nil {
noCompress = false
}

currentTime := options.TimeSource.Get()
messageBus := messagebus.New(65535)
Expand Down Expand Up @@ -86,7 +90,7 @@ func (s *SeedLinkService) Start(options *services.Options, waitGroup *sync.WaitG
serviceName: s.GetServiceName(),
},
)
go server.Start(serverHost.(string), serverPort.(int))
go server.Start(serverHost.(string), serverPort.(int), !noCompress.(bool))
logger.GetLogger(s.GetServiceName()).Infof("seedlink is listening on %s:%d", serverHost, serverPort)

logger.GetLogger(s.GetServiceName()).Infoln("service has been started")
Expand Down

0 comments on commit 6e6e17a

Please sign in to comment.