Skip to content
Open
Show file tree
Hide file tree
Changes from 2 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
1 change: 1 addition & 0 deletions examples/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -57,4 +57,5 @@
</plugin>
</plugins>
</build>

</project>
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
package io.mosn.layotto.examples.file;

import io.mosn.layotto.v1.RuntimeClientBuilder;
import io.mosn.layotto.v1.config.RuntimeProperties;
import io.mosn.layotto.v1.infrastructure.config.RuntimeProperties;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import spec.sdk.runtime.v1.client.RuntimeClient;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
package io.mosn.layotto.examples.helloworld;

import io.mosn.layotto.v1.RuntimeClientBuilder;
import io.mosn.layotto.v1.config.RuntimeProperties;
import io.mosn.layotto.v1.infrastructure.config.RuntimeProperties;
import spec.sdk.runtime.v1.client.RuntimeClient;

public class Hello {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
package io.mosn.layotto.examples.pubsub.publisher;

import io.mosn.layotto.v1.RuntimeClientBuilder;
import io.mosn.layotto.v1.config.RuntimeProperties;
import io.mosn.layotto.v1.infrastructure.config.RuntimeProperties;
import spec.sdk.runtime.v1.client.RuntimeClient;

public class Publisher {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
*/
package io.mosn.layotto.examples.pubsub.subscriber.impl;

import io.mosn.layotto.v1.callback.component.pubsub.Subscriber;
import io.mosn.layotto.v1.grpc.callback.component.pubsub.Subscriber;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import spec.sdk.runtime.v1.domain.pubsub.TopicEventRequest;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
package io.mosn.layotto.examples.state;

import io.mosn.layotto.v1.RuntimeClientBuilder;
import io.mosn.layotto.v1.config.RuntimeProperties;
import io.mosn.layotto.v1.infrastructure.config.RuntimeProperties;
import spec.sdk.runtime.v1.client.RuntimeClient;
import spec.sdk.runtime.v1.domain.state.GetBulkStateRequest;
import spec.sdk.runtime.v1.domain.state.State;
Expand All @@ -25,6 +25,7 @@
import java.util.List;

public class RedisCRUD {

static String storeName = "redis";
static String key1 = "key1";
static String key2 = "key2";
Expand Down
30 changes: 29 additions & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -13,17 +13,21 @@
<url>https://github.com/mosn/layotto</url>

<modules>
<module>sdk</module>
<module>examples</module>
<module>sdk</module>
<module>sdk-reactor</module>
<module>spec</module>
<module>sdk-grpc</module>
<module>sdk-domain</module>
<module>sdk-infrastructure</module>
</modules>

<properties>
<protobuf.version>3.17.2</protobuf.version>
<grpc.version>1.34.1</grpc.version>
<slf4j.version>1.7.30</slf4j.version>
<fastjson.version>1.2.69</fastjson.version>
<reactor-core.version>3.4.12</reactor-core.version>
<junit.version>4.13.1</junit.version>
<mockito.version>3.11.2</mockito.version>
</properties>
Expand All @@ -36,11 +40,32 @@
<artifactId>runtime-sdk</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>io.mosn.layotto</groupId>
<artifactId>runtime-sdk-reactor</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>io.mosn.layotto</groupId>
<artifactId>runtime-spec-pb</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>io.mosn.layotto</groupId>
<artifactId>runtime-sdk-grpc</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>io.mosn.layotto</groupId>
<artifactId>runtime-sdk-domain</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>io.mosn.layotto</groupId>
<artifactId>runtime-sdk-infrastructure</artifactId>
<version>${project.version}</version>
</dependency>

<!-- json -->
<dependency>
<groupId>com.alibaba</groupId>
Expand Down Expand Up @@ -76,6 +101,7 @@
<artifactId>grpc-stub</artifactId>
<version>${grpc.version}</version>
</dependency>

<!-- unit test -->
<dependency>
<groupId>org.mockito</groupId>
Expand Down Expand Up @@ -203,6 +229,7 @@
<url>http://github.com/mosn/layotto</url>
<connection>scm:git:https://github.com/mosn/layotto.git</connection>
</scm>

<profiles>
<profile>
<id>release</id>
Expand Down Expand Up @@ -260,4 +287,5 @@
</distributionManagement>
</profile>
</profiles>

</project>
36 changes: 36 additions & 0 deletions sdk-domain/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
<?xml version="1.0" encoding="UTF-8"?>
<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/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>

<parent>
<artifactId>runtime-sdk-parent</artifactId>
<groupId>io.mosn.layotto</groupId>
<version>1.1.0-SNAPSHOT</version>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could u add a version property to manage all the pom version?

</parent>

<artifactId>runtime-sdk-domain</artifactId>
<name>runtime-sdk-domain</name>
<description>Domain definition for Runtime</description>
<packaging>jar</packaging>

<properties>
</properties>

<dependencies>
<dependency>
<groupId>io.mosn.layotto</groupId>
<artifactId>runtime-sdk-infrastructure</artifactId>
</dependency>

<dependency>
<groupId>io.projectreactor</groupId>
<artifactId>reactor-core</artifactId>
<version>${reactor-core.version}</version>
<scope>compile</scope>
<optional>true</optional>
</dependency>
</dependencies>

</project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
/*
* Copyright 2021 Layotto Authors
* 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 spec.sdk.runtime.v1.domain;

import org.reactivestreams.Publisher;
import org.reactivestreams.Subscription;
import spec.sdk.runtime.v1.domain.configuration.ConfigurationItem;
import spec.sdk.runtime.v1.domain.configuration.ConfigurationRequestItem;
import spec.sdk.runtime.v1.domain.configuration.SaveConfigurationRequest;
import spec.sdk.runtime.v1.domain.configuration.SubConfigurationResp;

import java.util.List;

public interface ConfigurationRuntime {

/**
* Gets configuration from configuration store
*
* @param configurationRequestItem Request object.
*/
List<ConfigurationItem> getConfiguration(ConfigurationRequestItem configurationRequestItem);

/**
* Saves configuration into configuration store.
* @param saveConfigurationRequest Request object.
*/
void saveConfiguration(SaveConfigurationRequest saveConfigurationRequest);

/**
* Deletes configuration from configuration store.
*
* @param configurationRequestItem Request object.
*/
void deleteConfiguration(ConfigurationRequestItem configurationRequestItem);

/**
* Gets configuration from configuration store and subscribe the updates.
*
* @param configurationRequestItem Request object.
*/
void subscribeConfiguration(ConfigurationRequestItem configurationRequestItem, Subscriber subscriber);

interface Subscriber {

/**
* Data notification sent by the {@link Publisher} in response to requests to {@link Subscription#request(long)}.
*
* @param t the element signaled
*/
void onNext(SubConfigurationResp t);

/**
* Failed terminal state.
*
* @param t the throwable signaled
*/
void onError(Throwable t);

/**
* Successful terminal state.
*/
void onComplete();
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
/*
* Copyright 2021 Layotto Authors
* 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 spec.sdk.runtime.v1.domain;

import reactor.core.publisher.Flux;
import reactor.core.publisher.Mono;
import spec.sdk.runtime.v1.domain.configuration.ConfigurationItem;
import spec.sdk.runtime.v1.domain.configuration.ConfigurationRequestItem;
import spec.sdk.runtime.v1.domain.configuration.SaveConfigurationRequest;
import spec.sdk.runtime.v1.domain.configuration.SubConfigurationResp;

import java.util.List;

public interface ConfigurationRxRuntime extends ConfigurationRuntime {

/**
* Gets configuration from configuration store
*
* @param configurationRequestItem Request object.
*/
@Override
default List<ConfigurationItem> getConfiguration(ConfigurationRequestItem configurationRequestItem) {
return getConfigurationAsync(configurationRequestItem).block();
}

Mono<List<ConfigurationItem>> getConfigurationAsync(ConfigurationRequestItem configurationRequestItem);

/**
* Saves configuration into configuration store.
* ø
*
* @param saveConfigurationRequest Request object.
*/
@Override
default void saveConfiguration(SaveConfigurationRequest saveConfigurationRequest) {
saveConfigurationAsync(saveConfigurationRequest).block();
}

Mono<Void> saveConfigurationAsync(SaveConfigurationRequest saveConfigurationRequest);

/**
* Deletes configuration from configuration store.
*
* @param configurationRequestItem Request object.
*/
@Override
default void deleteConfiguration(ConfigurationRequestItem configurationRequestItem) {
deleteConfigurationAsync(configurationRequestItem).block();
}

Mono<Void> deleteConfigurationAsync(ConfigurationRequestItem configurationRequestItem);

/**
* Gets configuration from configuration store and subscribe the updates.
*
* @param configurationRequestItem Request object.
*/
@Override
default void subscribeConfiguration(ConfigurationRequestItem configurationRequestItem, Subscriber subscriber) {
Flux<SubConfigurationResp> subscribeConfigurationAsync = subscribeConfigurationAsync(configurationRequestItem);
subscribeConfigurationAsync.subscribe(
subscriber::onNext,
subscriber::onError,
subscriber::onComplete);
}

Flux<SubConfigurationResp> subscribeConfigurationAsync(ConfigurationRequestItem configurationRequestItem);
}
Original file line number Diff line number Diff line change
Expand Up @@ -30,35 +30,35 @@ public interface FileRuntime {
/**
* save or update file
*
* @param request
* @param request the put request
* @param timeoutMs If the time is less than or equal to zero, the method will not wait at all.
* @throws Exception Instance of RuntimeClientException Or StatusRuntimeException
*/
PutFileResponse putFile(PutFileRequest request, int timeoutMs) throws Exception;

/**
* @param request
* @param request the get request
* @param timeoutMs If the time is less than or equal to zero, the method will not wait at all.
* @throws Exception Instance of RuntimeClientException Or StatusRuntimeException
*/
GetFileResponse getFile(GetFileRequest request, int timeoutMs) throws Exception;

/**
* @param request
* @param request the list requset
* @param timeoutMs If the time is less than or equal to zero, the method will not wait at all.
* @throws Exception Instance of RuntimeClientException Or StatusRuntimeException
*/
ListFileResponse listFile(ListFileRequest request, int timeoutMs) throws Exception;

/**
* @param request
* @param request the del request
* @param timeoutMs If the time is less than or equal to zero, the method will not wait at all.
* @throws Exception Instance of RuntimeClientException Or StatusRuntimeException
*/
DelFileResponse delFile(DelFileRequest request, int timeoutMs) throws Exception;

/**
* @param request
* @param request the get meta request
* @param timeoutMs If the time is less than or equal to zero, the method will not wait at all.
* @throws Exception Instance of RuntimeClientException Or StatusRuntimeException
*/
Expand Down
Loading