Skip to content

Rx Concat and Package ReOrg #59

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 5 commits into from
Sep 22, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/main/java/io/reactivesocket/ConnectionSetupPayload.java
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@
*/
package io.reactivesocket;

import io.reactivesocket.internal.SetupFrameFlyweight;

import java.nio.ByteBuffer;

import io.reactivesocket.internal.frame.SetupFrameFlyweight;

/**
* Exposed to server for determination of RequestHandler based on mime types and SETUP metadata/data
*/
Expand Down
3 changes: 2 additions & 1 deletion src/main/java/io/reactivesocket/DuplexConnection.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@

import org.reactivestreams.Publisher;

import io.reactivesocket.observable.Observable;
import io.reactivesocket.rx.Completable;
import io.reactivesocket.rx.Observable;

/**
* Represents a connection with input/output that the protocol uses.
Expand Down
8 changes: 8 additions & 0 deletions src/main/java/io/reactivesocket/Frame.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,14 @@
package io.reactivesocket;

import io.reactivesocket.internal.*;
import io.reactivesocket.internal.frame.ErrorFrameFlyweight;
import io.reactivesocket.internal.frame.FrameHeaderFlyweight;
import io.reactivesocket.internal.frame.FramePool;
import io.reactivesocket.internal.frame.LeaseFrameFlyweight;
import io.reactivesocket.internal.frame.RequestFrameFlyweight;
import io.reactivesocket.internal.frame.RequestNFrameFlyweight;
import io.reactivesocket.internal.frame.SetupFrameFlyweight;
import io.reactivesocket.internal.frame.UnpooledFrame;
import uk.co.real_logic.agrona.DirectBuffer;
import uk.co.real_logic.agrona.MutableDirectBuffer;

Expand Down
2 changes: 2 additions & 0 deletions src/main/java/io/reactivesocket/LeaseGovernor.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
package io.reactivesocket;

import io.reactivesocket.internal.Responder;
import io.reactivesocket.lease.NullLeaseGovernor;
import io.reactivesocket.lease.UnlimitedLeaseGovernor;

public interface LeaseGovernor {
public static final LeaseGovernor NULL_LEASE_GOVERNOR = new NullLeaseGovernor();
Expand Down
11 changes: 6 additions & 5 deletions src/main/java/io/reactivesocket/ReactiveSocket.java
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,14 @@
import org.reactivestreams.Subscriber;
import org.reactivestreams.Subscription;

import io.reactivesocket.internal.CompositeCompletable;
import io.reactivesocket.internal.CompositeDisposable;
import io.reactivesocket.internal.Requester;
import io.reactivesocket.internal.Responder;
import io.reactivesocket.observable.Disposable;
import io.reactivesocket.observable.Observable;
import io.reactivesocket.observable.Observer;
import io.reactivesocket.internal.rx.CompositeCompletable;
import io.reactivesocket.internal.rx.CompositeDisposable;
import io.reactivesocket.rx.Completable;
import io.reactivesocket.rx.Disposable;
import io.reactivesocket.rx.Observable;
import io.reactivesocket.rx.Observer;
import uk.co.real_logic.agrona.BitUtil;

/**
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/io/reactivesocket/exceptions/Exceptions.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

import java.nio.ByteBuffer;

import static io.reactivesocket.internal.ErrorFrameFlyweight.*;
import static io.reactivesocket.internal.frame.ErrorFrameFlyweight.*;
import static java.nio.charset.StandardCharsets.UTF_8;

public class Exceptions {
Expand Down
57 changes: 57 additions & 0 deletions src/main/java/io/reactivesocket/internal/FragmentedPublisher.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
/**
* Copyright 2015 Netflix, Inc.
*
* Licensed 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.reactivesocket.internal;

import org.reactivestreams.Publisher;
import org.reactivestreams.Subscriber;
import org.reactivestreams.Subscription;

import io.reactivesocket.Frame;
import io.reactivesocket.FrameType;
import io.reactivesocket.Payload;
import io.reactivesocket.internal.frame.PayloadFragmenter;

public class FragmentedPublisher implements Publisher<Frame> {

private final PayloadFragmenter fragmenter = new PayloadFragmenter(Frame.METADATA_MTU, Frame.DATA_MTU);
private final Publisher<Payload> responsePublisher;
private final int streamId;
private final FrameType type;

public FragmentedPublisher(FrameType type, int streamId, Publisher<Payload> responsePublisher) {
this.type = type;
this.streamId = streamId;
this.responsePublisher = responsePublisher;
}

@Override
public void subscribe(Subscriber<? super Frame> child) {
child.onSubscribe(new Subscription() {

@Override
public void request(long n) {
// TODO Auto-generated method stub

}

@Override
public void cancel() {
// TODO Auto-generated method stub

}});
}

}
4 changes: 4 additions & 0 deletions src/main/java/io/reactivesocket/internal/PublisherUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,10 @@

import io.reactivesocket.Frame;
import io.reactivesocket.Payload;
import io.reactivesocket.internal.rx.BackpressureHelper;
import io.reactivesocket.internal.rx.BackpressureUtils;
import io.reactivesocket.internal.rx.EmptySubscription;
import io.reactivesocket.internal.rx.SubscriptionHelper;

public class PublisherUtils {

Expand Down
10 changes: 7 additions & 3 deletions src/main/java/io/reactivesocket/internal/Requester.java
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@
import org.reactivestreams.Subscriber;
import org.reactivestreams.Subscription;

import io.reactivesocket.Completable;
import io.reactivesocket.ConnectionSetupPayload;
import io.reactivesocket.DuplexConnection;
import io.reactivesocket.Frame;
Expand All @@ -38,8 +37,13 @@
import io.reactivesocket.exceptions.CancelException;
import io.reactivesocket.exceptions.Exceptions;
import io.reactivesocket.exceptions.Retryable;
import io.reactivesocket.observable.Disposable;
import io.reactivesocket.observable.Observer;
import io.reactivesocket.internal.frame.RequestFrameFlyweight;
import io.reactivesocket.internal.rx.BackpressureUtils;
import io.reactivesocket.internal.rx.EmptyDisposable;
import io.reactivesocket.internal.rx.EmptySubscription;
import io.reactivesocket.rx.Completable;
import io.reactivesocket.rx.Disposable;
import io.reactivesocket.rx.Observer;
import uk.co.real_logic.agrona.collections.Int2ObjectHashMap;

/**
Expand Down
9 changes: 7 additions & 2 deletions src/main/java/io/reactivesocket/internal/Responder.java
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,12 @@
import org.reactivestreams.Subscription;

import io.reactivesocket.exceptions.SetupException;
import io.reactivesocket.observable.Disposable;
import io.reactivesocket.observable.Observer;
import io.reactivesocket.internal.frame.SetupFrameFlyweight;
import io.reactivesocket.internal.rx.EmptyDisposable;
import io.reactivesocket.internal.rx.EmptySubscription;
import io.reactivesocket.rx.Completable;
import io.reactivesocket.rx.Disposable;
import io.reactivesocket.rx.Observer;
import uk.co.real_logic.agrona.collections.Int2ObjectHashMap;

/**
Expand Down Expand Up @@ -241,6 +245,7 @@ public void onNext(Frame requestFrame) {
final RejectedException exception = new RejectedException("No associated lease");
responsePublisher = PublisherUtils.errorFrame(streamId, exception);
}

connection.addOutput(responsePublisher, new Completable() {

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package io.reactivesocket.internal;
package io.reactivesocket.internal.frame;

import java.nio.ByteBuffer;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package io.reactivesocket.internal;
package io.reactivesocket.internal.frame;

import io.reactivesocket.FrameType;
import io.reactivesocket.exceptions.*;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,18 +13,18 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package io.reactivesocket.internal;
package io.reactivesocket.internal.frame;

import io.reactivesocket.FrameType;
import uk.co.real_logic.agrona.BitUtil;
import uk.co.real_logic.agrona.DirectBuffer;
import uk.co.real_logic.agrona.MutableDirectBuffer;

import static io.reactivesocket.internal.frame.ByteBufferUtil.*;

import java.nio.ByteBuffer;
import java.nio.ByteOrder;

import static io.reactivesocket.internal.ByteBufferUtil.preservingSlice;

/**
* Per connection frame flyweight.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package io.reactivesocket.internal;
package io.reactivesocket.internal.frame;

import io.reactivesocket.Frame;
import uk.co.real_logic.agrona.MutableDirectBuffer;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package io.reactivesocket.internal;
package io.reactivesocket.internal.frame;

import io.reactivesocket.FrameType;
import uk.co.real_logic.agrona.DirectBuffer;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package io.reactivesocket.internal;
package io.reactivesocket.internal.frame;

import io.reactivesocket.FrameType;
import uk.co.real_logic.agrona.BitUtil;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package io.reactivesocket.internal;
package io.reactivesocket.internal.frame;

import io.reactivesocket.Frame;
import io.reactivesocket.Payload;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package io.reactivesocket.internal;
package io.reactivesocket.internal.frame;

import io.reactivesocket.Frame;
import io.reactivesocket.FrameType;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,11 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package io.reactivesocket.internal;
package io.reactivesocket.internal.frame;

import io.reactivesocket.Frame;
import io.reactivesocket.Payload;

import org.reactivestreams.Subscriber;
import org.reactivestreams.Subscription;
import uk.co.real_logic.agrona.collections.Int2ObjectHashMap;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package io.reactivesocket.internal;
package io.reactivesocket.internal.frame;

import io.reactivesocket.FrameType;
import uk.co.real_logic.agrona.BitUtil;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package io.reactivesocket.internal;
package io.reactivesocket.internal.frame;

import io.reactivesocket.FrameType;
import uk.co.real_logic.agrona.BitUtil;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package io.reactivesocket.internal;
package io.reactivesocket.internal.frame;

import io.reactivesocket.FrameType;
import uk.co.real_logic.agrona.BitUtil;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package io.reactivesocket.internal;
package io.reactivesocket.internal.frame;

import io.reactivesocket.Frame;
import uk.co.real_logic.agrona.MutableDirectBuffer;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package io.reactivesocket.internal;
package io.reactivesocket.internal.frame;

import io.reactivesocket.Frame;
import uk.co.real_logic.agrona.MutableDirectBuffer;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package io.reactivesocket.internal;
package io.reactivesocket.internal.frame;

import io.reactivesocket.Frame;
import uk.co.real_logic.agrona.MutableDirectBuffer;
Expand Down
Loading