public class AddressSpaceView extends AbstractView
Created by mwei on 12/10/15.
Constructor and Description |
---|
AddressSpaceView(CorfuRuntime runtime)
Constructor for the Address Space View.
|
Modifier and Type | Method and Description |
---|---|
ILogData |
fetch(long address)
Explicitly fetch a given address, bypassing the cache.
|
Map<Long,ILogData> |
fetchAll(Iterable<Long> addresses,
boolean waitForWrite)
Fetch a collection of addresses for insertion into the cache.
|
void |
gc()
Force compaction on an address space, which will force
all log units to free space, and process any outstanding
trim requests.
|
void |
gc(long trimMark)
Remove all log entries that are less than the trim mark
|
TailsResponse |
getAllTails()
Get all tails, includes: log tail and stream tails.
|
StreamsAddressResponse |
getLogAddressSpace()
Get log address space, which includes:
1.
|
Long |
getLogTail()
Get the log's tail, i.e., last address in the address space.
|
Token |
getTrimMark()
Get the first address in the address space.
|
void |
invalidateClientCache()
Force the client cache to be invalidated.
|
void |
invalidateServerCaches()
Force all server caches to be invalidated.
|
ILogData |
peek(long address)
Directly read from the log, returning any
committed value, or NULL, if no value has
been committed.
|
ILogData |
predictiveReadRange(Long nextRead,
List<Long> addresses)
This method reads a batch of addresses if 'nextRead' is not found in the cache.
|
void |
prefixTrim(Token address)
Prefix trim the address space.
|
Map<Long,ILogData> |
read(Iterable<Long> addresses)
Read the given object from a range of addresses.
|
Map<Long,ILogData> |
read(Iterable<Long> addresses,
boolean waitForWrite)
Read the given object from a range of addresses.
|
ILogData |
read(long address)
Read the given object from an address and streams.
|
void |
resetCaches()
Reset all in-memory caches.
|
void |
write(IToken token,
Object data)
Write the given log data and then add it to the address
space cache (i.e.
|
void |
write(IToken token,
Object data,
CacheOption cacheOption)
Write the given log data using a token, returning
either when the write has been completed successfully,
or throwing an OverwriteException if another value
has been adopted, or a WrongEpochException if the
token epoch is invalid.
|
getCurrentLayout, layoutHelper, layoutHelper
public AddressSpaceView(@Nonnull CorfuRuntime runtime)
public void gc(long trimMark)
public void resetCaches()
public void write(@Nonnull IToken token, @Nonnull Object data, @Nonnull CacheOption cacheOption)
token
- The token to use for the write.data
- The data to write.cacheOption
- The caching behaviour for this writeOverwriteException
- If the globalAddress given
by the token has adopted
another value.WrongEpochException
- If the token epoch is invalid.public void write(IToken token, Object data) throws OverwriteException
OverwriteException
write(IToken, Object, CacheOption)
@Nullable public ILogData peek(long address)
address
- The address to read from.@Nonnull public ILogData read(long address)
address
- An address to read from.@Nonnull public ILogData predictiveReadRange(Long nextRead, List<Long> addresses)
nextRead
- current address of interestaddresses
- batch of addresses to read (bring into the cache) in case there is a cache miss (includes
nextRead)public Map<Long,ILogData> read(Iterable<Long> addresses)
addresses
- An iterable with addresses to read frompublic Map<Long,ILogData> read(Iterable<Long> addresses, boolean waitForWrite)
addresses
- An iterable with addresses to read fromwaitForWrite
- Flag whether wait for write is required or hole fill directly.public Token getTrimMark()
public Long getLogTail()
public TailsResponse getAllTails()
public StreamsAddressResponse getLogAddressSpace()
public void prefixTrim(Token address)
At the end of a prefix trim, all addresses equal to or less than the address given will be marked for trimming, which means that they may return either the original data, or a trimmed exception.
address
- log addresspublic void gc()
public void invalidateServerCaches()
public void invalidateClientCache()
@Nonnull public Map<Long,ILogData> fetchAll(Iterable<Long> addresses, boolean waitForWrite)
addresses
- collection of addresses to read from.waitForWrite
- flag whether wait for write is required or hole fill directly.Copyright © 2019 CorfuDB. All rights reserved.