-
Notifications
You must be signed in to change notification settings - Fork 3.8k
Move druid-api into the druid repo. #2720
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,103 @@ | ||
| <?xml version="1.0" encoding="UTF-8"?> | ||
| <!-- | ||
| ~ Licensed to Metamarkets Group Inc. (Metamarkets) under one | ||
| ~ or more contributor license agreements. See the NOTICE file | ||
| ~ distributed with this work for additional information | ||
| ~ regarding copyright ownership. Metamarkets licenses this file | ||
| ~ to you under the Apache License, Version 2.0 (the | ||
| ~ "License"); you may not use this file except in compliance | ||
| ~ with the License. You may obtain a copy of the License at | ||
| ~ | ||
| ~ http://www.apache.org/licenses/LICENSE-2.0 | ||
| ~ | ||
| ~ Unless required by applicable law or agreed to in writing, | ||
| ~ software distributed under the License is distributed on an | ||
| ~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
| ~ KIND, either express or implied. See the License for the | ||
| ~ specific language governing permissions and limitations | ||
| ~ under the License. | ||
| --> | ||
|
|
||
| <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> | ||
| <modelVersion>4.0.0</modelVersion> | ||
|
|
||
| <artifactId>druid-api</artifactId> | ||
| <name>druid-api</name> | ||
| <description>Druid Extensions API</description> | ||
|
|
||
| <parent> | ||
| <groupId>io.druid</groupId> | ||
| <artifactId>druid</artifactId> | ||
| <version>0.9.1-SNAPSHOT</version> | ||
| </parent> | ||
|
|
||
| <dependencies> | ||
| <dependency> | ||
| <groupId>com.metamx</groupId> | ||
| <artifactId>java-util</artifactId> | ||
| </dependency> | ||
| <dependency> | ||
| <groupId>com.google.inject</groupId> | ||
| <artifactId>guice</artifactId> | ||
| </dependency> | ||
| <dependency> | ||
| <groupId>com.google.inject.extensions</groupId> | ||
| <artifactId>guice-multibindings</artifactId> | ||
| </dependency> | ||
| <dependency> | ||
| <groupId>io.airlift</groupId> | ||
| <artifactId>airline</artifactId> | ||
| </dependency> | ||
| <dependency> | ||
| <groupId>com.fasterxml.jackson.core</groupId> | ||
| <artifactId>jackson-annotations</artifactId> | ||
| </dependency> | ||
| <dependency> | ||
| <groupId>com.fasterxml.jackson.core</groupId> | ||
| <artifactId>jackson-core</artifactId> | ||
| </dependency> | ||
| <dependency> | ||
| <groupId>com.fasterxml.jackson.core</groupId> | ||
| <artifactId>jackson-databind</artifactId> | ||
| </dependency> | ||
| <dependency> | ||
| <groupId>com.fasterxml.jackson.dataformat</groupId> | ||
| <artifactId>jackson-dataformat-smile</artifactId> | ||
| </dependency> | ||
| <dependency> | ||
| <groupId>org.hibernate</groupId> | ||
| <artifactId>hibernate-validator</artifactId> | ||
| </dependency> | ||
| <dependency> | ||
| <groupId>javax.validation</groupId> | ||
| <artifactId>validation-api</artifactId> | ||
| </dependency> | ||
| <dependency> | ||
| <groupId>commons-io</groupId> | ||
| <artifactId>commons-io</artifactId> | ||
| </dependency> | ||
|
|
||
| <!-- Tests --> | ||
| <dependency> | ||
| <groupId>junit</groupId> | ||
| <artifactId>junit</artifactId> | ||
| <scope>test</scope> | ||
| </dependency> | ||
| <dependency> | ||
| <groupId>org.slf4j</groupId> | ||
| <artifactId>slf4j-simple</artifactId> | ||
| <scope>test</scope> | ||
| <optional>true</optional> | ||
| </dependency> | ||
| </dependencies> | ||
|
|
||
| <build> | ||
| <plugins> | ||
| <plugin> | ||
| <groupId>org.apache.maven.plugins</groupId> | ||
| <artifactId>maven-release-plugin</artifactId> | ||
| </plugin> | ||
| </plugins> | ||
| </build> | ||
|
|
||
| </project> | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,29 @@ | ||
| /* | ||
| * Licensed to Metamarkets Group Inc. (Metamarkets) under one | ||
| * or more contributor license agreements. See the NOTICE file | ||
| * distributed with this work for additional information | ||
| * regarding copyright ownership. Metamarkets licenses this file | ||
| * to you under the Apache License, Version 2.0 (the | ||
| * "License"); you may not use this file except in compliance | ||
| * with the License. You may obtain a copy of the License at | ||
| * | ||
| * http://www.apache.org/licenses/LICENSE-2.0 | ||
| * | ||
| * Unless required by applicable law or agreed to in writing, | ||
| * software distributed under the License is distributed on an | ||
| * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
| * KIND, either express or implied. See the License for the | ||
| * specific language governing permissions and limitations | ||
| * under the License. | ||
| */ | ||
|
|
||
| package io.druid.cli; | ||
|
|
||
| import io.airlift.airline.Cli; | ||
|
|
||
| /** | ||
| */ | ||
| public interface CliCommandCreator | ||
| { | ||
| public void addCommands(Cli.CliBuilder builder); | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,27 @@ | ||
| /* | ||
| * Licensed to Metamarkets Group Inc. (Metamarkets) under one | ||
| * or more contributor license agreements. See the NOTICE file | ||
| * distributed with this work for additional information | ||
| * regarding copyright ownership. Metamarkets licenses this file | ||
| * to you under the Apache License, Version 2.0 (the | ||
| * "License"); you may not use this file except in compliance | ||
| * with the License. You may obtain a copy of the License at | ||
| * | ||
| * http://www.apache.org/licenses/LICENSE-2.0 | ||
| * | ||
| * Unless required by applicable law or agreed to in writing, | ||
| * software distributed under the License is distributed on an | ||
| * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
| * KIND, either express or implied. See the License for the | ||
| * specific language governing permissions and limitations | ||
| * under the License. | ||
| */ | ||
|
|
||
|
|
||
| package io.druid.cli; | ||
|
|
||
| /** | ||
| */ | ||
| public interface CliRunnable extends Runnable | ||
| { | ||
| } |
32 changes: 32 additions & 0 deletions
32
api/src/main/java/io/druid/data/input/ByteBufferInputRowParser.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,32 @@ | ||
| /* | ||
| * Licensed to Metamarkets Group Inc. (Metamarkets) under one | ||
| * or more contributor license agreements. See the NOTICE file | ||
| * distributed with this work for additional information | ||
| * regarding copyright ownership. Metamarkets licenses this file | ||
| * to you under the Apache License, Version 2.0 (the | ||
| * "License"); you may not use this file except in compliance | ||
| * with the License. You may obtain a copy of the License at | ||
| * | ||
| * http://www.apache.org/licenses/LICENSE-2.0 | ||
| * | ||
| * Unless required by applicable law or agreed to in writing, | ||
| * software distributed under the License is distributed on an | ||
| * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
| * KIND, either express or implied. See the License for the | ||
| * specific language governing permissions and limitations | ||
| * under the License. | ||
| */ | ||
|
|
||
|
|
||
| package io.druid.data.input; | ||
|
|
||
| import io.druid.data.input.impl.InputRowParser; | ||
| import io.druid.data.input.impl.ParseSpec; | ||
|
|
||
| import java.nio.ByteBuffer; | ||
|
|
||
| public interface ByteBufferInputRowParser extends InputRowParser<ByteBuffer> | ||
| { | ||
| @Override | ||
| public ByteBufferInputRowParser withParseSpec(ParseSpec parseSpec); | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,32 @@ | ||
| /* | ||
| * Licensed to Metamarkets Group Inc. (Metamarkets) under one | ||
| * or more contributor license agreements. See the NOTICE file | ||
| * distributed with this work for additional information | ||
| * regarding copyright ownership. Metamarkets licenses this file | ||
| * to you under the Apache License, Version 2.0 (the | ||
| * "License"); you may not use this file except in compliance | ||
| * with the License. You may obtain a copy of the License at | ||
| * | ||
| * http://www.apache.org/licenses/LICENSE-2.0 | ||
| * | ||
| * Unless required by applicable law or agreed to in writing, | ||
| * software distributed under the License is distributed on an | ||
| * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
| * KIND, either express or implied. See the License for the | ||
| * specific language governing permissions and limitations | ||
| * under the License. | ||
| */ | ||
|
|
||
| package io.druid.data.input; | ||
| /** | ||
| * Committer includes a Runnable and a Jackson-serialized metadata object containing the offset | ||
| */ | ||
| public interface Committer extends Runnable | ||
| { | ||
| /** | ||
| * @return A json serialized represenation of commit metadata, | ||
| * which needs to be serialized and deserialized by Jackson. | ||
| * Commit metadata can be a complex type, but we recommend keeping it to List/Map/"Primitive JSON" types | ||
| * */ | ||
| public Object getMetadata(); | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,78 @@ | ||
| /* | ||
| * Licensed to Metamarkets Group Inc. (Metamarkets) under one | ||
| * or more contributor license agreements. See the NOTICE file | ||
| * distributed with this work for additional information | ||
| * regarding copyright ownership. Metamarkets licenses this file | ||
| * to you under the Apache License, Version 2.0 (the | ||
| * "License"); you may not use this file except in compliance | ||
| * with the License. You may obtain a copy of the License at | ||
| * | ||
| * http://www.apache.org/licenses/LICENSE-2.0 | ||
| * | ||
| * Unless required by applicable law or agreed to in writing, | ||
| * software distributed under the License is distributed on an | ||
| * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
| * KIND, either express or implied. See the License for the | ||
| * specific language governing permissions and limitations | ||
| * under the License. | ||
| */ | ||
|
|
||
| package io.druid.data.input; | ||
|
|
||
| import java.io.Closeable; | ||
|
|
||
| /** | ||
| * This is an interface that holds onto the stream of incoming data. Realtime data ingestion is built around this | ||
| * abstraction. In order to add a new type of source for realtime data ingestion, all you need to do is implement | ||
| * one of these and register it with the Main. | ||
| * | ||
| * This object acts a lot like an Iterator, but it doesn't extend the Iterator interface because it extends | ||
| * Closeable and it is very important that the close() method doesn't get forgotten, which is easy to do if this | ||
| * gets passed around as an Iterator. | ||
| * <p> | ||
| * The implementation of this interface only needs to be minimally thread-safe. The three methods ##hasMore(), | ||
| * ##nextRow() and ##commit() are all called from the same thread. ##commit(), however, returns a callback | ||
| * which will be called on another thread, so the operations inside of that callback must be thread-safe. | ||
| * </p> | ||
| */ | ||
| public interface Firehose extends Closeable | ||
| { | ||
| /** | ||
| * Returns whether there are more rows to process. This is used to indicate that another item is immediately | ||
| * available via ##nextRow(). Thus, if the stream is still available but there are no new messages on it, this call | ||
| * should block until a new message is available. | ||
| * | ||
| * If something happens such that the stream is no longer available, this should return false. | ||
| * | ||
| * @return true if and when there is another row available, false if the stream has dried up | ||
| */ | ||
| public boolean hasMore(); | ||
|
|
||
| /** | ||
| * The next row available. Should only be called if hasMore returns true. | ||
| * | ||
| * @return The next row | ||
| */ | ||
| public InputRow nextRow() ; | ||
|
|
||
| /** | ||
| * Returns a runnable that will "commit" everything read up to the point at which commit() is called. This is | ||
| * often equivalent to everything that has been read since the last commit() call (or instantiation of the object), | ||
| * but doesn't necessarily have to be. | ||
| * | ||
| * This method is called when the main processing loop starts to persist its current batch of things to process. | ||
| * The returned runnable will be run when the current batch has been successfully persisted, there is usually | ||
| * some time lag between when this method is called and when the runnable is run. The Runnable is also run on | ||
| * a separate thread so its operation should be thread-safe. | ||
| * | ||
| * The Runnable is essentially just a lambda/closure that is run() after data supplied by this instance has | ||
| * been committed on the writer side of this interface protocol. | ||
| * <p> | ||
| * A simple implementation of this interface might do nothing when run() is called | ||
| * (in which case the same do-nothing instance can be returned every time), or | ||
| * a more complex implementation might clean up temporary resources that are no longer needed | ||
| * because of InputRows delivered by prior calls to ##nextRow(). | ||
| * </p> | ||
| */ | ||
| public Runnable commit(); | ||
| } |
41 changes: 41 additions & 0 deletions
41
api/src/main/java/io/druid/data/input/FirehoseFactory.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,41 @@ | ||
| /* | ||
| * Licensed to Metamarkets Group Inc. (Metamarkets) under one | ||
| * or more contributor license agreements. See the NOTICE file | ||
| * distributed with this work for additional information | ||
| * regarding copyright ownership. Metamarkets licenses this file | ||
| * to you under the Apache License, Version 2.0 (the | ||
| * "License"); you may not use this file except in compliance | ||
| * with the License. You may obtain a copy of the License at | ||
| * | ||
| * http://www.apache.org/licenses/LICENSE-2.0 | ||
| * | ||
| * Unless required by applicable law or agreed to in writing, | ||
| * software distributed under the License is distributed on an | ||
| * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
| * KIND, either express or implied. See the License for the | ||
| * specific language governing permissions and limitations | ||
| * under the License. | ||
| */ | ||
|
|
||
| package io.druid.data.input; | ||
|
|
||
| import com.fasterxml.jackson.annotation.JsonTypeInfo; | ||
| import com.metamx.common.parsers.ParseException; | ||
| import io.druid.data.input.impl.InputRowParser; | ||
|
|
||
| import java.io.IOException; | ||
|
|
||
| @JsonTypeInfo(use = JsonTypeInfo.Id.NAME, property = "type") | ||
| public interface FirehoseFactory<T extends InputRowParser> | ||
| { | ||
| /** | ||
| * Initialization method that connects up the fire hose. If this method returns successfully it should be safe to | ||
| * call hasMore() on the returned Firehose (which might subsequently block). | ||
| * <p/> | ||
| * If this method returns null, then any attempt to call hasMore(), nextRow(), commit() and close() on the return | ||
| * value will throw a surprising NPE. Throwing IOException on connection failure or runtime exception on | ||
| * invalid configuration is preferred over returning null. | ||
| */ | ||
| public Firehose connect(T parser) throws IOException, ParseException; | ||
|
|
||
| } |
44 changes: 44 additions & 0 deletions
44
api/src/main/java/io/druid/data/input/FirehoseFactoryV2.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,44 @@ | ||
| /* | ||
| * Licensed to Metamarkets Group Inc. (Metamarkets) under one | ||
| * or more contributor license agreements. See the NOTICE file | ||
| * distributed with this work for additional information | ||
| * regarding copyright ownership. Metamarkets licenses this file | ||
| * to you under the Apache License, Version 2.0 (the | ||
| * "License"); you may not use this file except in compliance | ||
| * with the License. You may obtain a copy of the License at | ||
| * | ||
| * http://www.apache.org/licenses/LICENSE-2.0 | ||
| * | ||
| * Unless required by applicable law or agreed to in writing, | ||
| * software distributed under the License is distributed on an | ||
| * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
| * KIND, either express or implied. See the License for the | ||
| * specific language governing permissions and limitations | ||
| * under the License. | ||
| */ | ||
|
|
||
| package io.druid.data.input; | ||
|
|
||
| import com.fasterxml.jackson.annotation.JsonTypeInfo; | ||
| import com.metamx.common.parsers.ParseException; | ||
| import io.druid.data.input.impl.InputRowParser; | ||
|
|
||
| import java.io.IOException; | ||
| /** | ||
| * Initialization method that connects up the FirehoseV2. If this method returns successfully it should be safe to | ||
| * call start() on the returned FirehoseV2 (which might subsequently block). | ||
| * | ||
| * In contrast to V1 version, FirehoseFactoryV2 is able to pass an additional json-serialized object to FirehoseV2, | ||
| * which contains last commit metadata | ||
| * | ||
| * <p/> | ||
| * If this method returns null, then any attempt to call start(), advance(), currRow(), makeCommitter() and close() on the return | ||
| * value will throw a surprising NPE. Throwing IOException on connection failure or runtime exception on | ||
| * invalid configuration is preferred over returning null. | ||
| */ | ||
| @JsonTypeInfo(use = JsonTypeInfo.Id.NAME, property = "type") | ||
| public interface FirehoseFactoryV2<T extends InputRowParser> | ||
| { | ||
| public FirehoseV2 connect(T parser, Object lastCommit) throws IOException, ParseException; | ||
|
|
||
| } |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can you fix the header to be the standard license header instead of the old-style header?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
adjusted