// DO NOT modify this class. It was generated from LeafRegionEntry.cpp
 private void diskInitialize(RegionEntryContext context, Object value) {
   DiskRecoveryStore drs = (DiskRecoveryStore) context;
   DiskStoreImpl ds = drs.getDiskStore();
   long maxOplogSize = ds.getMaxOplogSize();
   // get appropriate instance of DiskId implementation based on maxOplogSize
   this.id = DiskId.createDiskId(maxOplogSize, true /* is persistence */, ds.needsLinkedList());
   Helper.initialize(this, drs, value);
 }
예제 #2
0
  /**
   * Tests that an instance of 'PersistenceIntOplogOffsetDiskId' is created when max-oplog-size (in
   * bytes) passed is smaller than Integer.MAX_VALUE
   */
  public void testOverflowIntDiskIdInstance() {
    int maxOplogSizeinMB = 2;

    DiskId diskId = DiskId.createDiskId(maxOplogSizeinMB, false /*is overflow type*/, true);
    assertTrue(
        "Instance of 'OverflowIntOplogOffsetDiskId' was not created though max oplog size (in bytes) was smaller than Integer.MAX_VALUE",
        DiskId.isInstanceofOverflowIntOplogOffsetDiskId(diskId));
  }
예제 #3
0
  /**
   * Tests that an instance of 'PersistenceIntOplogOffsetDiskId' is created when max-oplog-size (in
   * bytes) passed is smaller than Integer.MAX_VALUE
   */
  public void testPersistIntDiskIdInstance() {
    int maxOplogSizeinMB = 2;

    DiskId diskId = DiskId.createDiskId(maxOplogSizeinMB, true /*is persistence type*/, true);
    assertTrue(
        "Instance of 'PersistIntOplogOffsetDiskId' was not created though max oplog size (in bytes) was smaller than Integer.MAX_VALUE",
        DiskId.isInstanceofPersistIntOplogOffsetDiskId(diskId));
  }
예제 #4
0
  /**
   * Tests that an instance of 'LongOplogOffsetDiskId' is created when max-oplog-size (in bytes)
   * passed is greater than Integer.MAX_VALUE
   */
  public void testOverflowLongDiskIdInstance() {
    long maxOplogSizeInBytes = (long) Integer.MAX_VALUE + 1;
    int maxOplogSizeinMB = (int) (maxOplogSizeInBytes / (1024 * 1024));

    DiskId diskId = DiskId.createDiskId(maxOplogSizeinMB, false /* is overflow type */, true);
    assertTrue(
        "Instance of 'OverflowLongOplogOffsetDiskId' was not created though max oplog size (in bytes) was greater than Integer.MAX_VALUE",
        DiskId.isInstanceofOverflowOnlyWithLongOffset(diskId));
  }
예제 #5
0
  /**
   * Tests that an instance of 'LongOplogOffsetDiskId' is created when max-oplog-size (in bytes)
   * passed is greater than Integer.MAX_VALUE
   */
  public void testPersistLongDiskIdInstance() {
    long maxOplogSizeInBytes = (long) Integer.MAX_VALUE + 1;
    int maxOplogSizeinMB = (int) (maxOplogSizeInBytes / (1024 * 1024));

    DiskId diskId = DiskId.createDiskId(maxOplogSizeinMB, true /* is persistence type */, true);
    assertTrue(
        "Instance of 'PersistLongOplogOffsetDiskId' was not created though max oplog size (in bytes) was greater than Integer.MAX_VALUE",
        DiskId.isInstanceofPersistLongOplogOffsetDiskId(diskId));
  }
 //  // inlining DiskId
 //  // always have these fields
 //  /**
 //   * id consists of
 //   * most significant
 //   * 1 byte = users bits
 //   * 2-8 bytes = oplog id
 //   * least significant.
 //   *
 //   * The highest bit in the oplog id part is set to 1 if the oplog id
 //   * is negative.
 //   * @todo this field could be an int for an overflow only region
 //   */
 //  private long id;
 //  /**
 //   * Length of the bytes on disk.
 //   * This is always set. If the value is invalid then it will be set to 0.
 //   * The most significant bit is used by overflow to mark it as needing to be written.
 //   */
 //  protected int valueLength = 0;
 //  // have intOffset or longOffset
 //  // intOffset
 //  /**
 //   * The position in the oplog (the oplog offset) where this entry's value is
 //   * stored
 //   */
 //  private volatile int offsetInOplog;
 //  // longOffset
 //  /**
 //   * The position in the oplog (the oplog offset) where this entry's value is
 //   * stored
 //   */
 //  private volatile long offsetInOplog;
 //  // have overflowOnly or persistence
 //  // overflowOnly
 //  // no fields
 //  // persistent
 //  /** unique entry identifier * */
 //  private long keyId;
 // DO NOT modify this class. It was generated from LeafRegionEntry.cpp
 // lru code
 @Override
 public void setDelayedDiskId(LocalRegion r) {
   DiskStoreImpl ds = r.getDiskStore();
   long maxOplogSize = ds.getMaxOplogSize();
   this.id = DiskId.createDiskId(maxOplogSize, false /* over flow only */, ds.needsLinkedList());
 }
예제 #7
0
 private DiskId getDiskId() {
   return DiskId.createDiskId(1024, true /* is persistence type*/, true);
 }