io

package
v0.0.0-...-08f17c8 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 26, 2024 License: BSD-3-Clause Imports: 11 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AsyncCacheThroughReader

type AsyncCacheThroughReader struct {
	// contains filtered or unexported fields
}

AsyncCacheThroughReader helps sync read through cache

func (*AsyncCacheThroughReader) AddReadersForPrefetching

func (reader *AsyncCacheThroughReader) AddReadersForPrefetching(readers []Reader)

GetFSClient returns fs client

func (*AsyncCacheThroughReader) GetAvailable

func (reader *AsyncCacheThroughReader) GetAvailable(offset int64) int64

GetAvailable returns available data len

func (*AsyncCacheThroughReader) GetChecksum

func (reader *AsyncCacheThroughReader) GetChecksum() string

GetChecksum returns checksum of the file

func (*AsyncCacheThroughReader) GetError

func (reader *AsyncCacheThroughReader) GetError() error

func (*AsyncCacheThroughReader) GetFSClient

func (reader *AsyncCacheThroughReader) GetFSClient() irods.IRODSFSClient

GetFSClient returns fs client

func (*AsyncCacheThroughReader) GetPath

func (reader *AsyncCacheThroughReader) GetPath() string

GetPath returns path of the file

func (*AsyncCacheThroughReader) GetSize

func (reader *AsyncCacheThroughReader) GetSize() int64

GetSize returns size of the file

func (*AsyncCacheThroughReader) ReadAt

func (reader *AsyncCacheThroughReader) ReadAt(buffer []byte, offset int64) (int, error)

ReadAt reads data

func (*AsyncCacheThroughReader) Release

func (reader *AsyncCacheThroughReader) Release()

Release releases all resources

type AsyncWriter

type AsyncWriter struct {
	// contains filtered or unexported fields
}

AsyncWriter helps async write

func (*AsyncWriter) Flush

func (writer *AsyncWriter) Flush() error

Flush flushes buffered data

func (*AsyncWriter) GetError

func (writer *AsyncWriter) GetError() error

GetError returns error

func (*AsyncWriter) GetFSClient

func (writer *AsyncWriter) GetFSClient() irods.IRODSFSClient

GetFSClient returns fs client

func (*AsyncWriter) GetPath

func (writer *AsyncWriter) GetPath() string

GetPath returns path

func (*AsyncWriter) Release

func (writer *AsyncWriter) Release()

Release releases all resources

func (*AsyncWriter) WriteAt

func (writer *AsyncWriter) WriteAt(data []byte, offset int64) (int, error)

Write writes data

type FileBlock

type FileBlock struct {
	// contains filtered or unexported fields
}

func NewFileBlock

func NewFileBlock(blockID int64) *FileBlock

func NewFileBlockWithBuffer

func NewFileBlockWithBuffer(blockID int64, buffer *bytes.Buffer, eof bool) *FileBlock

type FileBlockStore

type FileBlockStore struct {
	// contains filtered or unexported fields
}

func NewFileBlockStore

func NewFileBlockStore(cacheStore cache.CacheStore, path string, checksum string, blockSize int) (*FileBlockStore, error)

func (*FileBlockStore) Contains

func (store *FileBlockStore) Contains(blockID int64) bool

func (*FileBlockStore) Get

func (store *FileBlockStore) Get(blockID int64) *FileBlock

func (*FileBlockStore) GetBlockSize

func (store *FileBlockStore) GetBlockSize() int

func (*FileBlockStore) Put

func (store *FileBlockStore) Put(block *FileBlock) error

func (*FileBlockStore) Release

func (store *FileBlockStore) Release()

type FileBlockTransfer

type FileBlockTransfer struct {
	// contains filtered or unexported fields
}

func NewFileBlockTransfer

func NewFileBlockTransfer(blockID int64) *FileBlockTransfer

func (*FileBlockTransfer) CopyTo

func (transfer *FileBlockTransfer) CopyTo(buffer []byte, offset int) (int, error)

func (*FileBlockTransfer) GetBlockID

func (transfer *FileBlockTransfer) GetBlockID() int64

func (*FileBlockTransfer) GetBuffer

func (transfer *FileBlockTransfer) GetBuffer() *bytes.Buffer

func (*FileBlockTransfer) GetBufferLen

func (transfer *FileBlockTransfer) GetBufferLen() int

func (*FileBlockTransfer) IsCompleted

func (transfer *FileBlockTransfer) IsCompleted() bool

func (*FileBlockTransfer) IsEOF

func (transfer *FileBlockTransfer) IsEOF() bool

func (*FileBlockTransfer) IsFailed

func (transfer *FileBlockTransfer) IsFailed() bool

func (*FileBlockTransfer) MarkCompleted

func (transfer *FileBlockTransfer) MarkCompleted(eof bool)

func (*FileBlockTransfer) MarkFailed

func (transfer *FileBlockTransfer) MarkFailed()

func (*FileBlockTransfer) WaitForData

func (transfer *FileBlockTransfer) WaitForData(size int) bool

func (*FileBlockTransfer) Write

func (transfer *FileBlockTransfer) Write(buffer []byte)

type FileBlockTransferMap

type FileBlockTransferMap struct {
	// contains filtered or unexported fields
}

func NewFileBlockTransferMap

func NewFileBlockTransferMap() *FileBlockTransferMap

func (*FileBlockTransferMap) Clean

func (transferMap *FileBlockTransferMap) Clean()

func (*FileBlockTransferMap) Contains

func (transferMap *FileBlockTransferMap) Contains(blockID int64) bool

func (*FileBlockTransferMap) Get

func (transferMap *FileBlockTransferMap) Get(blockID int64) *FileBlockTransfer

func (*FileBlockTransferMap) Put

func (transferMap *FileBlockTransferMap) Put(transfer *FileBlockTransfer)

func (*FileBlockTransferMap) Remove

func (transferMap *FileBlockTransferMap) Remove(blockID int64)

func (*FileBlockTransferMap) StopAllTransfers

func (transferMap *FileBlockTransferMap) StopAllTransfers()

type NilReader

type NilReader struct {
	// contains filtered or unexported fields
}

NilReader does nothing for read

func (*NilReader) GetAvailable

func (reader *NilReader) GetAvailable(offset int64) int64

GetAvailable returns available data len

func (*NilReader) GetChecksum

func (reader *NilReader) GetChecksum() string

GetChecksum returns checksum of the file

func (*NilReader) GetError

func (reader *NilReader) GetError() error

GetError returns error if exists

func (*NilReader) GetFSClient

func (reader *NilReader) GetFSClient() irods.IRODSFSClient

GetFSClient returns fs client

func (*NilReader) GetPath

func (reader *NilReader) GetPath() string

GetPath returns path of the file

func (*NilReader) GetSize

func (reader *NilReader) GetSize() int64

GetSize returns size of the file

func (*NilReader) ReadAt

func (reader *NilReader) ReadAt(buffer []byte, offset int64) (int, error)

ReadAt reads data

func (*NilReader) Release

func (reader *NilReader) Release()

Release releases all resources

type NilWriter

type NilWriter struct {
	// contains filtered or unexported fields
}

NilWriter does nothing for write

func (*NilWriter) Flush

func (writer *NilWriter) Flush() error

func (*NilWriter) GetError

func (writer *NilWriter) GetError() error

func (*NilWriter) GetFSClient

func (writer *NilWriter) GetFSClient() irods.IRODSFSClient

GetFSClient returns fs client

func (*NilWriter) GetPath

func (writer *NilWriter) GetPath() string

GetPath returns path of the file

func (*NilWriter) Release

func (writer *NilWriter) Release()

Release releases all resources

func (*NilWriter) WriteAt

func (writer *NilWriter) WriteAt(data []byte, offset int64) (int, error)

WriteAt writes data

type Prefetcher

type Prefetcher struct {
	// contains filtered or unexported fields
}

func NewPrefetcher

func NewPrefetcher(blockSize int) *Prefetcher

func (*Prefetcher) Determine

func (prefetcher *Prefetcher) Determine(offset int64, size int64) []int64

type Reader

type Reader interface {
	GetFSClient() irods.IRODSFSClient
	GetPath() string
	GetChecksum() string
	GetSize() int64

	// io.ReaderAt
	ReadAt(buffer []byte, offset int64) (int, error)
	GetAvailable(offset int64) int64 // -1 for unknown

	GetError() error
	Release()
}

Reader helps data read

func NewAsyncCacheThroughReader

func NewAsyncCacheThroughReader(readers []Reader, blockSize int, cacheStore cache.CacheStore) (Reader, error)

NewAsyncCacheThroughReader create a new AsyncCacheThroughReader

func NewAsyncReader

func NewAsyncReader(readers []Reader, blockSize int) (Reader, error)

func NewNilReader

func NewNilReader(fsClient irods.IRODSFSClient, fileHandle irods.IRODSFSFileHandle) Reader

NewNilReader create a new NilReader

func NewSyncReader

func NewSyncReader(fsClient irods.IRODSFSClient, fileHandle irods.IRODSFSFileHandle, reportClient report.IRODSFSInstanceReportClient) Reader

NewSyncReader create a new SyncReader

type SyncBufferedWriter

type SyncBufferedWriter struct {
	// contains filtered or unexported fields
}

SyncBufferedWriter is a writer that buffers data in RAM before write

func (*SyncBufferedWriter) Flush

func (writer *SyncBufferedWriter) Flush() error

Flush flushes buffered data

func (*SyncBufferedWriter) GetError

func (writer *SyncBufferedWriter) GetError() error

GetError returns error

func (*SyncBufferedWriter) GetFSClient

func (writer *SyncBufferedWriter) GetFSClient() irods.IRODSFSClient

GetFSClient returns fs client

func (*SyncBufferedWriter) GetPath

func (writer *SyncBufferedWriter) GetPath() string

GetPath returns path of the file

func (*SyncBufferedWriter) Release

func (writer *SyncBufferedWriter) Release()

Release releases all resources

func (*SyncBufferedWriter) WriteAt

func (writer *SyncBufferedWriter) WriteAt(data []byte, offset int64) (int, error)

Write writes data

type SyncReader

type SyncReader struct {
	// contains filtered or unexported fields
}

SyncReader helps sync read

func (*SyncReader) GetAvailable

func (reader *SyncReader) GetAvailable(offset int64) int64

GetAvailable returns available data len

func (*SyncReader) GetChecksum

func (reader *SyncReader) GetChecksum() string

GetChecksum returns checksum of the file

func (*SyncReader) GetError

func (reader *SyncReader) GetError() error

func (*SyncReader) GetFSClient

func (reader *SyncReader) GetFSClient() irods.IRODSFSClient

GetFSClient returns fs client

func (*SyncReader) GetPath

func (reader *SyncReader) GetPath() string

GetPath returns path of the file

func (*SyncReader) GetSize

func (reader *SyncReader) GetSize() int64

GetSize returns size of the file

func (*SyncReader) ReadAt

func (reader *SyncReader) ReadAt(buffer []byte, offset int64) (int, error)

ReadAt reads data

func (*SyncReader) Release

func (reader *SyncReader) Release()

Release releases all resources

type SyncWriter

type SyncWriter struct {
	// contains filtered or unexported fields
}

SyncWriter helps sync write

func (*SyncWriter) Flush

func (writer *SyncWriter) Flush() error

func (*SyncWriter) GetError

func (writer *SyncWriter) GetError() error

func (*SyncWriter) GetFSClient

func (writer *SyncWriter) GetFSClient() irods.IRODSFSClient

GetFSClient returns fs client

func (*SyncWriter) GetPath

func (writer *SyncWriter) GetPath() string

GetPath returns path of the file

func (*SyncWriter) Release

func (writer *SyncWriter) Release()

Release releases all resources

func (*SyncWriter) WriteAt

func (writer *SyncWriter) WriteAt(data []byte, offset int64) (int, error)

WriteAt writes data

type Writer

type Writer interface {
	GetFSClient() irods.IRODSFSClient
	GetPath() string

	// io.WriterAt
	WriteAt(data []byte, offset int64) (int, error)

	Flush() error
	GetError() error
	Release()
}

Writer helps data write

func NewAsyncWriter

func NewAsyncWriter(writer Writer) Writer

NewAsyncWriter create a new AsyncWriter

func NewNilWriter

func NewNilWriter(fsClient irods.IRODSFSClient, fileHandle irods.IRODSFSFileHandle) Writer

NewNilWriter create a new NilWriter

func NewSyncBufferedWriter

func NewSyncBufferedWriter(writer Writer, bufferSize int) Writer

NewSyncBufferedWriter creates a SyncBufferedWriter

func NewSyncWriter

func NewSyncWriter(fsClient irods.IRODSFSClient, fileHandle irods.IRODSFSFileHandle, reportClient report.IRODSFSInstanceReportClient) Writer

NewSyncWriter create a new SyncWriter

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL