[TACHYON-152] Client write refactor

Rewriting how client writes out blocks to make it easier to add remote blocks.

The current design is as follows:

Users requests access to a block for writing.

```java
WritableBlockChannel channel = Blocks.createWritableBlock(tachyonFS, blockId, blockCapacityByte);
channel.write(byteBuffer);
channel.close();
```

When the block is full, write returns -1, so you do this in a loop and create new blocks.

```java
while (buffer.remaining() > 0) {
  int n = mCurrentBlockChannel.write(buffer);
  if (n <= 0) {
    // block full, get new block
    getNextBlock();
  }
}
```
Let's talk about this more next week.
On Sep 19, 2014 12:15 PM, "Henry Saputra" <notifications@github.com> wrote:

> In core/src/main/java/tachyon/client/ForwardingWritableBlockChannel.java:
>
> > +  @Override
> > +  public int write(ByteBuffer src) throws IOException {
> > +    return delegate().write(src);
> > +  }
> > +
> > +  @Override
> > +  public boolean isOpen() {
> > +    return delegate().isOpen();
> > +  }
> > +
> > +  @Override
> > +  public void close() throws IOException {
> > +    delegate().close();
> > +  }
> > +
> > +  public T delegate() {
>
> Yeah, but we are not developing in Guava =)
> I am thinking either do get and set for all access to internal member or
> get rid of all. Need to make sure we are in sync.
>
> —
> Reply to this email directly or view it on GitHub
> <https://github.com/amplab/tachyon/pull/427/files#r17803700>.
>