Package me.ahoo.cosid.store.remote
Class RemoteStore
java.lang.Object
me.ahoo.cosid.store.remote.RemoteStore
- All Implemented Interfaces:
AutoCloseable,me.ahoo.cosid.store.Store
The remote store (06-stores.md ยง2.5, 08-remote.md): both primitives as calls to
cosid-server, which runs
them on its own backing store. One round trip per call over the JDK HttpClient; no third-party
dependency.
Errors the primitives have an outcome for map to it (410 โ RangeSealedException,
409 slots_exhausted โ AcquireResult.Exhausted, 409 lease_lost โ an empty
renew or a false release, ...); every other failure throws a RemoteStoreException.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final DurationThe connect timeout when none is configured. -
Constructor Summary
Constructors -
Method Summary
-
Field Details
-
DEFAULT_CONNECT_TIMEOUT
The connect timeout when none is configured.
-
-
Constructor Details
-
RemoteStore
public RemoteStore(URI baseUrl, Optional<String> token, Duration connectTimeout, Duration requestTimeout) A store on a server.- Parameters:
baseUrl- the server, such ashttp://cosid-server:8080token- the bearer token; empty for a server that allows anonymous callsconnectTimeout- the connect timeoutrequestTimeout- the timeout of each call
-
-
Method Details
-
baseUrl
The server.- Returns:
- the base URL, without a trailing slash
-
ranges
public me.ahoo.cosid.segment.RangeStore ranges()- Specified by:
rangesin interfaceme.ahoo.cosid.store.Store
-
slots
public me.ahoo.cosid.lease.SlotLeaseStore slots()- Specified by:
slotsin interfaceme.ahoo.cosid.store.Store
-
close
public void close()Closes the HTTP client.- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceme.ahoo.cosid.store.Store
-