Package org.apache.aurora.gen.storage

Examples of org.apache.aurora.gen.storage.LogEntry


    createNoMessagesStreamManager().readFromBeginning(reader);
  }

  @Test
  public void testStreamManagerReadFromUnknownSome() throws CodingException {
    LogEntry transaction1 = createLogEntry(
        Op.removeJob(new RemoveJob(JobKeys.from("role", "env", "job").newBuilder())));
    Entry entry1 = createMock(Entry.class);
    expect(entry1.contents()).andReturn(encode(transaction1));
    expect(stream.readAll()).andReturn(Iterators.singletonIterator(entry1));
View Full Code Here


    control.replay(); // No easymock expectations used here

    Op op1 = Op.removeJob(new RemoveJob(JobKeys.from("r1", "env", "name").newBuilder()));
    final Op op2 = Op.removeJob(new RemoveJob(JobKeys.from("r2", "env", "name").newBuilder()));

    LogEntry transaction1 = createLogEntry(op1);
    LogEntry transaction2 = createLogEntry(op2);

    final CountDownLatch message1Started = new CountDownLatch(1);

    Message message1 = frame(transaction1);
    Message message2 = frame(transaction2);
View Full Code Here

    }
  }

  @Test
  public void testStreamManagerReadFrames() throws Exception {
    LogEntry transaction1 = createLogEntry(
        Op.removeJob(new RemoveJob(JobKeys.from("r1", "env", "name").newBuilder())));
    LogEntry transaction2 = createLogEntry(
        Op.removeJob(new RemoveJob(JobKeys.from("r2", "env", "name").newBuilder())));

    Message message = frame(transaction1);

    List<Entry> entries = Lists.newArrayList();
View Full Code Here

  }

  @Test
  public void testWriteAndReadDeflatedEntry() throws Exception {
    Snapshot snapshot = createSnapshot();
    LogEntry snapshotLogEntry = LogEntry.snapshot(snapshot);
    LogEntry deflatedSnapshotEntry = Entries.deflate(snapshotLogEntry);

    Entry snapshotEntry = createMock(Entry.class);
    expect(stream.append(entryEq(deflatedSnapshotEntry))).andReturn(position1);
    stream.truncateBefore(position1);
View Full Code Here

    });

    Entry entry1 = createMock(Entry.class);
    Entry entry2 = createMock(Entry.class);
    String frameworkId1 = "bob";
    LogEntry recoveredEntry1 =
        createTransaction(Op.saveFrameworkId(new SaveFrameworkId(frameworkId1)));
    String frameworkId2 = "jim";
    LogEntry recoveredEntry2 =
        createTransaction(Op.saveFrameworkId(new SaveFrameworkId(frameworkId2)));
    expect(entry1.contents()).andReturn(ThriftBinaryCodec.encodeNonNull(recoveredEntry1));
    expect(entry2.contents()).andReturn(ThriftBinaryCodec.encodeNonNull(recoveredEntry2));
    expect(stream.readAll()).andReturn(Iterators.forArray(entry1, entry2));
View Full Code Here

        throws CodingException, InvalidPositionException, StreamAccessException {

      Iterator<Entry> entries = stream.readAll();

      while (entries.hasNext()) {
        LogEntry logEntry = decodeLogEntry(entries.next());
        while (logEntry != null && isFrame(logEntry)) {
          logEntry = tryDecodeFrame(logEntry.getFrame(), entries);
        }
        if (logEntry != null) {
          if (logEntry.isSet(_Fields.DEFLATED_ENTRY)) {
            logEntry = Entries.inflate(logEntry);
            vars.deflatedEntriesRead.incrementAndGet();
          }

          reader.execute(logEntry);
View Full Code Here

      for (int i = 0; i < header.chunkCount; i++) {
        if (!entries.hasNext()) {
          logBadFrame(header, i);
          return null;
        }
        LogEntry logEntry = decodeLogEntry(entries.next());
        if (!isFrame(logEntry)) {
          logBadFrame(header, i);
          return logEntry;
        }
        Frame chunkFrame = logEntry.getFrame();
        if (!isChunk(chunkFrame)) {
          logBadFrame(header, i);
          return logEntry;
        }
        byte[] chunkData = chunkFrame.getChunk().getData();
View Full Code Here

     */
    @Timed("log_manager_snapshot")
    void snapshot(Snapshot snapshot)
        throws CodingException, InvalidPositionException, StreamAccessException {

      LogEntry entry = LogEntry.snapshot(snapshot);
      if (deflateSnapshots) {
        entry = Entries.deflate(entry);
      }

      Position position = appendAndGetPosition(entry);
View Full Code Here

     *
     * @param ops Operations to expect in the transaction.
     * @return An expectation setter.
     */
    public IExpectationSetters<Position> expectTransaction(Op...ops) {
      LogEntry entry = LogEntry.transaction(
          new Transaction(ImmutableList.copyOf(ops), storageConstants.CURRENT_SCHEMA_VERSION));
      return expect(stream.append(sameEntry(entry)));
    }
View Full Code Here

     *
     * @param snapshot Expected snapshot.
     * @return An expectation setter.
     */
    public IExpectationSetters<Position> expectSnapshot(Snapshot snapshot) {
      LogEntry entry = LogEntry.snapshot(snapshot);
      return expect(stream.append(sameEntry(entry)));
    }
View Full Code Here

TOP

Related Classes of org.apache.aurora.gen.storage.LogEntry

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.