Was this page helpful?

SingleFileQueueStream Class

    Table of contents
    1. 1. Remarks
    2. 2. Members
      1. 2.1. Constructors
      2. 2.2. Properties
      3. 2.3. Methods
    Table of Contents
    public class SingleFileQueueStream
    Namespace: MindTouch.IO
    Assembly: mindtouch.dream
    Type Hierarchy:
    • object
      • SingleFileQueueStream
    Implements:
    A record store with semantics for sequentially writing and retrieving records, similar to a queue, except that a read removes the head next record, but does not delete it until delete is called, allowing for transactional dequeuing of records.

    Remarks

    This implementation is backed by a single binary stream, which keeps growing until all records are marked as deleted, at which time the stream is truncacted. Exists primarily for use with MindTouch.Collections.TransactionalQueue<T>. This class is not threadsafe.

    Members

    Constructors

    Visibility Description
    Public SingleFileQueueStream(string path) Create from file path. File will be opened for exclusive write and closed and disposed when the instance is disposed
    Public SingleFileQueueStream(Stream stream) Create from an existing stream and the stream will be disposed when the instance is disposed.

    Properties

    Visibility Description
    Public UnreadCount Count of all records not yet read in current session

    Methods

    Visibility Description
    Public Dispose() Dispose the instance per System.IDisposable pattern
    Public AppendRecord(Stream stream, long length) Append the given stream as a new record. It is assumed that the stream's position is set to the appropriate position.
    Public DeleteRecord(IQueueStreamHandle location) Permanently remove a record from the stream, identified by the MindTouch.IO.IQueueStreamHandle attached to the MindTouch.IO.QueueStreamRecord returned by SingleFileQueueStream.ReadNextRecord().
    Public ReadNextRecord() Read the next unread record from the stream. Will return QueueStreamRecord.Empty if there is no next record in the stream.
    Public Truncate() Truncate the QueueStream and drop all records.
    Public ToString() (Inherited from Object)
    Public Equals(object obj) (Inherited from Object)
    Public GetHashCode() (Inherited from Object)
    Public GetType() (Inherited from Object)
    Protected MemberwiseClone() (Inherited from Object)
    Was this page helpful?
    Tag page
    You must login to post a comment.

    Copyright © 2011 MindTouch, Inc. Powered by