Many resources are needed to download a project. Please understand that we have to compensate our server costs. Thank you in advance. Project price only 1 $
You can buy this project and download/modify it how often you want.
This is the api to interact with Concourse, a schemaless and distributed version control database with optimistic availability, serializable transactions and full-text search. Concourse provides a more intuitive approach to data management that is easy to deploy, access and scale with minimal tuning while also maintaining the referential integrity and ACID characteristics of traditional database systems.
/*
* The MIT License (MIT)
*
* Copyright (c) 2013 Jeff Nelson, Cinchapi Software Collective
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
package org.cinchapi.concourse;
import java.util.Map;
import java.util.Set;
import java.util.concurrent.Callable;
import javax.annotation.Nullable;
import org.apache.thrift.TException;
import org.apache.thrift.protocol.TBinaryProtocol;
import org.apache.thrift.protocol.TProtocol;
import org.apache.thrift.transport.TSocket;
import org.apache.thrift.transport.TTransport;
import org.apache.thrift.transport.TTransportException;
import org.cinchapi.concourse.config.ConcourseConfiguration;
import org.cinchapi.concourse.thrift.AccessToken;
import org.cinchapi.concourse.thrift.ConcourseService;
import org.cinchapi.concourse.thrift.Operator;
import org.cinchapi.concourse.thrift.TObject;
import org.cinchapi.concourse.thrift.TransactionToken;
import org.cinchapi.concourse.time.Time;
import org.cinchapi.concourse.util.Convert;
import org.cinchapi.concourse.util.Transformers;
import org.cinchapi.concourse.util.TLinkedHashMap;
import org.joda.time.DateTime;
import com.google.common.base.Function;
import com.google.common.base.Throwables;
import com.google.common.collect.Lists;
/**
*
* Concourse is a schemaless and distributed version control database with
* optimistic availability, serializable transactions and full-text search.
* Concourse provides a more intuitive approach to data management that is easy
* to deploy, access and scale with minimal tuning while also maintaining the
* referential integrity and ACID characteristics of traditional database
* systems.
*
*
Data Model
*
* The Concourse data model is lightweight and flexible which enables it to
* support any kind of data at very large scales. Concourse trades unnecessary
* structural notions of schemas, tables and indexes for a more natural modeling
* of data based solely on the following concepts:
*
*
*
*
Record — A logical grouping of data about a single
* person, place, or thing (i.e. an object). Each {@code record} is a collection
* of key/value pairs that are together identified by a unique primary key.
*
Key — An attribute that maps to a set of
* one or more distinct {@code values}. A {@code record} can have many
* different {@code keys}, and the {@code keys} in one {@code record} do not
* affect the those in another {@code record}.
*
Value — A dynamically typed quantity that is
* mapped from a {@code key} in a {@code record}.
*
*
*
Data Types
*
* Concourse natively stores most of the Java primitives: boolean, double,
* float, integer, long, and string (UTF-8). Otherwise, the value of the
* {@link #toString()} method for the Object is stored.
*
*
Links
*
* Concourse supports linking a {@code key} in one {@code record} to another
* {@code record}. Links are one-directional, but it is possible to add two
* links that are the inverse of each other to simulate bi-directionality (i.e.
* link "friend" in Record 1 to Record 2 and link "friend" in Record 2 to Record
* 1).
*
*
Transactions
*
* By default, Concourse conducts every operation in {@code autocommit} mode
* where every change is immediately written. Concourse also supports the
* ability to stage a group of operations in transactions that are atomic,
* consistent, isolated, and durable using the {@link #stage()},
* {@link #commit()} and {@link #abort()} methods.
*
*
*
* @author jnelson
*/
public interface Concourse {
/**
* Discard any changes that are currently staged for commit.
*
* After this function returns, Concourse will return to {@code autocommit}
* mode and all subsequent changes will be immediately written to the
* database.
*
*/
public void abort();
/**
* Add {@code key} as {@code value} to {@code record} and return
* {@code true} if the mapping does not currently exist in {@code record}
* and is successfully added.
*
* @param key
* @param value
* @param record
* @return {@code true} if the mapping is added
*/
public boolean add(String key, T value, long record);
/**
* Audit {@code record} and return a log of revisions.
*
* @param record
* @return a mapping of timestamps to revision descriptions
*/
public Map audit(long record);
/**
* Audit {@code key} in {@code record} and return a log of revisions.
*
* @param key
* @param record
* @return a mapping of timestamps to revision descriptions
*/
public Map audit(String key, long record);
/**
* Clear {@code key} in {@code record} and remove every mapping
* from {@code key} that currently exists in {@code record}.
*
* @param record
*/
public void clear(String key, long record);
/**
* Attempt to permanently commit all the currently staged changes. This
* function returns {@code true} if and only if all the changes can be
* successfully applied to the database. Otherwise, this function returns
* {@code false} and all the changes are aborted.
*
* After this function returns, Concourse will return to {@code autocommit}
* mode and all subsequent changes will be immediately written to the
* database.
*
*/
public boolean commit();
/**
* Create a new Record and return its Primary Key.
*
* @return the Primary Key of the new Record
*/
public long create();
/**
* Describe {@code record} and return its set of keys that currently map to
* at least one value.
*
* @param record
* @return the populated keys
*/
public Set describe(long record);
/**
* Describe {@code record} at {@code timestamp} and return its set of keys
* that mapped to at least one value.
*
* @param record
* @param timestamp
* @return the keys for populated keys
*/
public Set describe(long record, DateTime timestamp);
/**
* Disconnect from the remote Concourse server.
*/
public void exit();
/**
* Fetch {@code key} from {@code record} and return the set of currently
* mapped values.
*
* @param key
* @param record
* @return the contained values
*/
public Set