Documentation ¶
Index ¶
- Constants
- type DB
- type RedisDB
- func (r *RedisDB) GetEncoding(ctx context.Context, encodingHash string) ([]byte, error)
- func (r *RedisDB) GetMultipleEncodings(ctx context.Context, encodingHashList ...string) ([][]byte, error)
- func (r *RedisDB) InsertEncoding(ctx context.Context, encodingHash string, byteStream []byte) error
- func (r *RedisDB) InsertEncodings(ctx context.Context, keys []string, blocks [][]byte) error
- func (r *RedisDB) IsEncodingAvailable(ctx context.Context, encodingHash string) (bool, error)
- type Service
- func (s *Service) AssembleBlob(ctx context.Context, r encode.Recipe, b encode.BlockResponse, ...) ([]byte, error)
- func (s *Service) GetAvailableBlocksFromDB(ctx context.Context, recipe encode.Recipe) (encode.Declaration, [][]byte, error)
- func (s *Service) GetDeclaration(ctx context.Context, recipe encode.Recipe) (encode.Declaration, error)
- func (s *Service) InsertMissingEncodings(ctx context.Context, recipe encode.Recipe, d encode.Declaration, ...) error
Constants ¶
const Debug bool = false
Debug flag
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type DB ¶
type DB interface { // IsEncodingAvailable will check if an encoding is avaialble in the db IsEncodingAvailable(ctx context.Context, encodingHash string) (bool, error) // GetEncoding gets encoding from the db GetEncoding(ctx context.Context, encodingHash string) ([]byte, error) //InsertEncoding will insert the encoding in the db InsertEncoding(ctx context.Context, encodingHash string, byteStream []byte) error //InsertEncodings will insert a list of encodings in the db InsertEncodings(ctx context.Context, encodings []string, blocks [][]byte) error //GetMultipleEncodings will get a list of encodings corresponding to the list provided GetMultipleEncodings(ctx context.Context, encodingHashList ...string) ([][]byte, error) }
DB is an interface to the data structure which holds the encoding
type RedisDB ¶
type RedisDB struct {
// contains filtered or unexported fields
}
RedisDB provides the service to retreive and manage the encodings from the db
func NewRedisDB ¶
func NewRedisDB() RedisDB
NewRedisDB will generate a new DB object satisfying the ENcodeDB ifc
func (*RedisDB) GetEncoding ¶
GetEncoding will get the encoding from the db
func (*RedisDB) GetMultipleEncodings ¶
func (r *RedisDB) GetMultipleEncodings(ctx context.Context, encodingHashList ...string) ([][]byte, error)
GetMultipleEncodings will get the list of encodings from the db
func (*RedisDB) InsertEncoding ¶
InsertEncoding will insert the encoding in the db
func (*RedisDB) InsertEncodings ¶
InsertEncodings will insert a collection of encodings in the db
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
Service class embodices the functionality to
func (*Service) AssembleBlob ¶
func (s *Service) AssembleBlob(ctx context.Context, r encode.Recipe, b encode.BlockResponse, dbBlocks [][]byte, lengthOfByteStream int) ([]byte, error)
AssembleBlob will assemble the blob using the recipe and the byte streams
func (*Service) GetAvailableBlocksFromDB ¶
func (s *Service) GetAvailableBlocksFromDB(ctx context.Context, recipe encode.Recipe) (encode.Declaration, [][]byte, error)
GetAvailableBlocksFromDB gets available blocks from db and constructs a declaration
func (*Service) GetDeclaration ¶
func (s *Service) GetDeclaration(ctx context.Context, recipe encode.Recipe) (encode.Declaration, error)
GetDeclaration will get the 'declaration' which indicates which encodings reffered by the recipe are already held by the service for the recipe