Documentation ¶
Overview ¶
Package frameio contains tools to work with Signal for Android's BackupFrames
Index ¶
- func BlobSizeOf(frame *signal.BackupFrame) uint32
- func CopyFrames(ctx context.Context, writer FrameWriter, reader FrameReader) error
- type BackupFramesReadCloser
- type BackupFramesWriteCloser
- type Encoder
- type FrameReadCloser
- type FrameReader
- type FrameWriteCloser
- type FrameWriter
- type MockEncoder
- type MockFrameReadCloser
- type MockFrameReader
- type MockFrameWriteCloser
- type MockFrameWriter
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BlobSizeOf ¶
func BlobSizeOf(frame *signal.BackupFrame) uint32
BlobSizeOf tells you how big the blob for a given frame is
func CopyFrames ¶
func CopyFrames(ctx context.Context, writer FrameWriter, reader FrameReader) error
CopyFrames copies all frames from a FrameReader to a FrameWriter. It does not close either.
Types ¶
type BackupFramesReadCloser ¶
type BackupFramesReadCloser struct {
BackupFrames signal.BackupFrames
}
func (*BackupFramesReadCloser) Close ¶
func (f *BackupFramesReadCloser) Close() error
func (*BackupFramesReadCloser) Read ¶
func (f *BackupFramesReadCloser) Read(backupFrame *signal.BackupFrame, _ *[]byte) error
type BackupFramesWriteCloser ¶
type BackupFramesWriteCloser struct { Output io.WriteCloser Encoder Encoder BackupFrames signal.BackupFrames }
func (*BackupFramesWriteCloser) Close ¶
func (f *BackupFramesWriteCloser) Close() error
func (*BackupFramesWriteCloser) Write ¶
func (f *BackupFramesWriteCloser) Write(backupFrame *signal.BackupFrame, _ []byte) error
type Encoder ¶
type Encoder interface { Unmarshal(b []byte, m protoreflect.ProtoMessage) error Marshal(m proto.Message) ([]byte, error) }
type FrameReadCloser ¶
type FrameReadCloser interface { FrameReader io.Closer }
FrameReadCloser = FrameReader + io.Closer
func NewBackupFramesReadCloser ¶
func NewBackupFramesReadCloser(input io.ReadCloser, decoder Encoder) (FrameReadCloser, error)
type FrameReader ¶
type FrameReader interface { // Read puts a *signal.BackupFrame into the first argument you provide, and puts any blob read (e.g. an attachment) into the second argument you provide. // This allows you to reuse things, e.g. reuse a buffer for attachments. // Should return io.EOF on last frame. Read(backupFrameDest *signal.BackupFrame, blobDest *[]byte) error }
FrameReader allows reading *signal.BackupFrames, similar to io.Reader
func NewAttachmentFrameReader ¶
func NewAttachmentFrameReader(ctx context.Context, attachments attachments.Store) (FrameReader, error)
func NewMergedReader ¶
func NewMergedReader(ctx context.Context, reader FrameReader, attachments attachments.Store) FrameReader
func NewMultiReader ¶
func NewMultiReader(readers ...FrameReader) FrameReader
NewMultiReader creates a FrameReader that can read from several FrameReaders, sequentially. The first frame reader provided should provide the Header, and so on. If an End frame is encountered, it will be skipped. After calling Read enough times to go through all of the frames, an End frame will be provided via Read.
type FrameWriteCloser ¶
type FrameWriteCloser interface { FrameWriter io.Closer }
FrameWriteCloser = FrameWriter + io.Closer
func NewBackupFramesWriteCloser ¶
func NewBackupFramesWriteCloser(output io.WriteCloser, encoder Encoder) FrameWriteCloser
type FrameWriter ¶
type FrameWriter interface { // Writes out a BackupFrame, and optionally an attachment as well Write(backupFrame *signal.BackupFrame, blob []byte) error }
FrameWriter allows writing *signal.BackupFrames, similar to io.Writer
func NewMultiWriter ¶
func NewMultiWriter(writers ...FrameWriter) FrameWriter
type MockEncoder ¶
MockEncoder is an autogenerated mock type for the Encoder type
func (*MockEncoder) Marshal ¶
func (_m *MockEncoder) Marshal(m protoreflect.ProtoMessage) ([]byte, error)
Marshal provides a mock function with given fields: m
func (*MockEncoder) Unmarshal ¶
func (_m *MockEncoder) Unmarshal(b []byte, m protoreflect.ProtoMessage) error
Unmarshal provides a mock function with given fields: b, m
type MockFrameReadCloser ¶
MockFrameReadCloser is an autogenerated mock type for the FrameReadCloser type
func (*MockFrameReadCloser) Close ¶
func (_m *MockFrameReadCloser) Close() error
Close provides a mock function with given fields:
func (*MockFrameReadCloser) Read ¶
func (_m *MockFrameReadCloser) Read(backupFrameDest *signal.BackupFrame, blobDest *[]byte) error
Read provides a mock function with given fields: backupFrameDest, blobDest
type MockFrameReader ¶
MockFrameReader is an autogenerated mock type for the FrameReader type
func (*MockFrameReader) Read ¶
func (_m *MockFrameReader) Read(backupFrameDest *signal.BackupFrame, blobDest *[]byte) error
Read provides a mock function with given fields: backupFrameDest, blobDest
type MockFrameWriteCloser ¶
MockFrameWriteCloser is an autogenerated mock type for the FrameWriteCloser type
func (*MockFrameWriteCloser) Close ¶
func (_m *MockFrameWriteCloser) Close() error
Close provides a mock function with given fields:
func (*MockFrameWriteCloser) Write ¶
func (_m *MockFrameWriteCloser) Write(backupFrame *signal.BackupFrame, blob []byte) error
Write provides a mock function with given fields: backupFrame, blob
type MockFrameWriter ¶
MockFrameWriter is an autogenerated mock type for the FrameWriter type
func (*MockFrameWriter) Write ¶
func (_m *MockFrameWriter) Write(backupFrame *signal.BackupFrame, blob []byte) error
Write provides a mock function with given fields: backupFrame, blob