Skip to content

Commit

Permalink
Move NewEncoder/NewDecoder into defaults
Browse files Browse the repository at this point in the history
This is to break an import cycle.
  • Loading branch information
Eugene Kim committed Dec 19, 2018
1 parent 9f8e243 commit e721c49
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 22 deletions.
19 changes: 19 additions & 0 deletions pkg/defaults/default.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,22 @@ func DefaultEncoderFactory() raptorq.EncoderFactory {
func DefaultDecoderFactory() raptorq.DecoderFactory {
return &libraptorq.DecoderFactory{}
}

// NewEncoder creates and returns an encoder using the default factory.
func NewEncoder(
input []byte, symbolSize uint16, minSubSymbolSize uint16,
maxSubBlockSize uint32, alignment uint8,
) (enc raptorq.Encoder, err error) {
factory := DefaultEncoderFactory()
return factory.New(
input, symbolSize, minSubSymbolSize, maxSubBlockSize, alignment,
)
}

// NewDecoder creates and returns a decoder using the default factory.
func NewDecoder(commonOTI uint64, schemeSpecificOTI uint32) (
dec raptorq.Decoder, err error,
) {
factory := DefaultDecoderFactory()
return factory.New(commonOTI, schemeSpecificOTI)
}
22 changes: 0 additions & 22 deletions pkg/raptorq/default.go

This file was deleted.

0 comments on commit e721c49

Please sign in to comment.