Repository: mesos Updated Branches: refs/heads/master e670ce7a5 -> ea09704c2
Added resource provider API protobuf template. Resource provider API will be Event/Call based, similar to the scheduler or executor API. Resource providers will use this API to interact with the master, sending Calls to the master and receiving Event from the master. Review: https://reviews.apache.org/r/58133 Project: http://git-wip-us.apache.org/repos/asf/mesos/repo Commit: http://git-wip-us.apache.org/repos/asf/mesos/commit/ea09704c Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/ea09704c Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/ea09704c Branch: refs/heads/master Commit: ea09704c2db6f6600688c1e2af8fe7999a5e6672 Parents: e670ce7 Author: Jie Yu <[email protected]> Authored: Fri Mar 31 17:10:13 2017 -0700 Committer: Jie Yu <[email protected]> Committed: Tue Apr 4 16:01:37 2017 -0700 ---------------------------------------------------------------------- .../resource_provider/resource_provider.hpp | 23 +++++++ .../resource_provider/resource_provider.proto | 48 ++++++++++++++ .../v1/resource_provider/resource_provider.hpp | 23 +++++++ .../resource_provider/resource_provider.proto | 48 ++++++++++++++ src/CMakeLists.txt | 66 +++++++++++--------- src/Makefile.am | 24 +++++++ 6 files changed, 201 insertions(+), 31 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/mesos/blob/ea09704c/include/mesos/resource_provider/resource_provider.hpp ---------------------------------------------------------------------- diff --git a/include/mesos/resource_provider/resource_provider.hpp b/include/mesos/resource_provider/resource_provider.hpp new file mode 100644 index 0000000..039c7c2 --- /dev/null +++ b/include/mesos/resource_provider/resource_provider.hpp @@ -0,0 +1,23 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF 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. + +#ifndef __MESOS_RESOURCE_PROVIDER_HPP__ +#define __MESOS_RESOURCE_PROVIDER_HPP__ + +// ONLY USEFUL AFTER RUNNING PROTOC. +#include <mesos/resource_provider/resource_provider.pb.h> + +#endif // __MESOS_RESOURCE_PROVIDER_HPP__ http://git-wip-us.apache.org/repos/asf/mesos/blob/ea09704c/include/mesos/resource_provider/resource_provider.proto ---------------------------------------------------------------------- diff --git a/include/mesos/resource_provider/resource_provider.proto b/include/mesos/resource_provider/resource_provider.proto new file mode 100644 index 0000000..73cfd31 --- /dev/null +++ b/include/mesos/resource_provider/resource_provider.proto @@ -0,0 +1,48 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF 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. + +syntax = "proto2"; + +package mesos.resource_provider; + +option java_package = "org.apache.mesos.resource_provider"; +option java_outer_classname = "Protos"; + + +message Event { + enum Type { + // This must be the first enum value in this list, to + // ensure that if 'type' is not set, the default value + // is UNKNOWN. This enables enum values to be added + // in a backwards-compatible way. See: MESOS-4997. + UNKNOWN = 0; + } + + optional Type type = 1; +} + + +message Call { + enum Type { + // This must be the first enum value in this list, to + // ensure that if 'type' is not set, the default value + // is UNKNOWN. This enables enum values to be added + // in a backwards-compatible way. See: MESOS-4997. + UNKNOWN = 0; + } + + optional Type type = 1; +} http://git-wip-us.apache.org/repos/asf/mesos/blob/ea09704c/include/mesos/v1/resource_provider/resource_provider.hpp ---------------------------------------------------------------------- diff --git a/include/mesos/v1/resource_provider/resource_provider.hpp b/include/mesos/v1/resource_provider/resource_provider.hpp new file mode 100644 index 0000000..2b8c8af --- /dev/null +++ b/include/mesos/v1/resource_provider/resource_provider.hpp @@ -0,0 +1,23 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF 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. + +#ifndef __MESOS_V1_RESOURCE_PROVIDER_HPP__ +#define __MESOS_V1_RESOURCE_PROVIDER_HPP__ + +// ONLY USEFUL AFTER RUNNING PROTOC. +#include <mesos/v1/resource_provider/resource_provider.pb.h> + +#endif // __MESOS_V1_RESOURCE_PROVIDER_HPP__ http://git-wip-us.apache.org/repos/asf/mesos/blob/ea09704c/include/mesos/v1/resource_provider/resource_provider.proto ---------------------------------------------------------------------- diff --git a/include/mesos/v1/resource_provider/resource_provider.proto b/include/mesos/v1/resource_provider/resource_provider.proto new file mode 100644 index 0000000..f83586d --- /dev/null +++ b/include/mesos/v1/resource_provider/resource_provider.proto @@ -0,0 +1,48 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF 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. + +syntax = "proto2"; + +package mesos.v1.resource_provider; + +option java_package = "org.apache.mesos.v1.resource_provider"; +option java_outer_classname = "Protos"; + + +message Event { + enum Type { + // This must be the first enum value in this list, to + // ensure that if 'type' is not set, the default value + // is UNKNOWN. This enables enum values to be added + // in a backwards-compatible way. See: MESOS-4997. + UNKNOWN = 0; + } + + optional Type type = 1; +} + + +message Call { + enum Type { + // This must be the first enum value in this list, to + // ensure that if 'type' is not set, the default value + // is UNKNOWN. This enables enum values to be added + // in a backwards-compatible way. See: MESOS-4997. + UNKNOWN = 0; + } + + optional Type type = 1; +} http://git-wip-us.apache.org/repos/asf/mesos/blob/ea09704c/src/CMakeLists.txt ---------------------------------------------------------------------- diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 08f0ef1..89cbd3f 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -19,37 +19,39 @@ include(MesosProtobuf) # Build the protobuf structs. -PROTOC_TO_INCLUDE_DIR(ACLS mesos/authorizer/acls) -PROTOC_TO_INCLUDE_DIR(AGENT mesos/agent/agent) -PROTOC_TO_INCLUDE_DIR(ALLOCATOR mesos/allocator/allocator) -PROTOC_TO_INCLUDE_DIR(APPC_SPEC mesos/appc/spec) -PROTOC_TO_INCLUDE_DIR(AUTHENTICATION mesos/authentication/authentication) -PROTOC_TO_INCLUDE_DIR(AUTHORIZATION mesos/authorizer/authorizer) -PROTOC_TO_INCLUDE_DIR(CONTAINERIZER mesos/slave/containerizer) -PROTOC_TO_INCLUDE_DIR(DOCKER_SPEC mesos/docker/spec) -PROTOC_TO_INCLUDE_DIR(DOCKER_V1 mesos/docker/v1) -PROTOC_TO_INCLUDE_DIR(DOCKER_V2 mesos/docker/v2) -PROTOC_TO_INCLUDE_DIR(EXECUTOR mesos/executor/executor) -PROTOC_TO_INCLUDE_DIR(FETCHER mesos/fetcher/fetcher) -PROTOC_TO_INCLUDE_DIR(HOOK mesos/module/hook) -PROTOC_TO_INCLUDE_DIR(MAINTENANCE mesos/maintenance/maintenance) -PROTOC_TO_INCLUDE_DIR(MASTER mesos/master/master) -PROTOC_TO_INCLUDE_DIR(MESOS mesos/mesos) -PROTOC_TO_INCLUDE_DIR(MODULE mesos/module/module) -PROTOC_TO_INCLUDE_DIR(OVERSUBSCRIPTION mesos/slave/oversubscription) -PROTOC_TO_INCLUDE_DIR(OCI_SPEC mesos/oci/spec) -PROTOC_TO_INCLUDE_DIR(QUOTA mesos/quota/quota) -PROTOC_TO_INCLUDE_DIR(SCHEDULER mesos/scheduler/scheduler) -PROTOC_TO_INCLUDE_DIR(STATE mesos/state/state) -PROTOC_TO_INCLUDE_DIR(URI mesos/uri/uri) -PROTOC_TO_INCLUDE_DIR(V1_AGENT mesos/v1/agent/agent) -PROTOC_TO_INCLUDE_DIR(V1_ALLOCATOR mesos/v1/allocator/allocator) -PROTOC_TO_INCLUDE_DIR(V1_EXECUTOR mesos/v1/executor/executor) -PROTOC_TO_INCLUDE_DIR(V1_MAINTENANCE mesos/v1/maintenance/maintenance) -PROTOC_TO_INCLUDE_DIR(V1_MASTER mesos/v1/master/master) -PROTOC_TO_INCLUDE_DIR(V1_MESOS mesos/v1/mesos) -PROTOC_TO_INCLUDE_DIR(V1_QUOTA mesos/v1/quota/quota) -PROTOC_TO_INCLUDE_DIR(V1_SCHEDULER mesos/v1/scheduler/scheduler) +PROTOC_TO_INCLUDE_DIR(ACLS mesos/authorizer/acls) +PROTOC_TO_INCLUDE_DIR(AGENT mesos/agent/agent) +PROTOC_TO_INCLUDE_DIR(ALLOCATOR mesos/allocator/allocator) +PROTOC_TO_INCLUDE_DIR(APPC_SPEC mesos/appc/spec) +PROTOC_TO_INCLUDE_DIR(AUTHENTICATION mesos/authentication/authentication) +PROTOC_TO_INCLUDE_DIR(AUTHORIZATION mesos/authorizer/authorizer) +PROTOC_TO_INCLUDE_DIR(CONTAINERIZER mesos/slave/containerizer) +PROTOC_TO_INCLUDE_DIR(DOCKER_SPEC mesos/docker/spec) +PROTOC_TO_INCLUDE_DIR(DOCKER_V1 mesos/docker/v1) +PROTOC_TO_INCLUDE_DIR(DOCKER_V2 mesos/docker/v2) +PROTOC_TO_INCLUDE_DIR(EXECUTOR mesos/executor/executor) +PROTOC_TO_INCLUDE_DIR(FETCHER mesos/fetcher/fetcher) +PROTOC_TO_INCLUDE_DIR(HOOK mesos/module/hook) +PROTOC_TO_INCLUDE_DIR(MAINTENANCE mesos/maintenance/maintenance) +PROTOC_TO_INCLUDE_DIR(MASTER mesos/master/master) +PROTOC_TO_INCLUDE_DIR(MESOS mesos/mesos) +PROTOC_TO_INCLUDE_DIR(MODULE mesos/module/module) +PROTOC_TO_INCLUDE_DIR(OVERSUBSCRIPTION mesos/slave/oversubscription) +PROTOC_TO_INCLUDE_DIR(OCI_SPEC mesos/oci/spec) +PROTOC_TO_INCLUDE_DIR(QUOTA mesos/quota/quota) +PROTOC_TO_INCLUDE_DIR(RESOURCE_PROVIDER mesos/resource_provider/resource_provider) +PROTOC_TO_INCLUDE_DIR(SCHEDULER mesos/scheduler/scheduler) +PROTOC_TO_INCLUDE_DIR(STATE mesos/state/state) +PROTOC_TO_INCLUDE_DIR(URI mesos/uri/uri) +PROTOC_TO_INCLUDE_DIR(V1_AGENT mesos/v1/agent/agent) +PROTOC_TO_INCLUDE_DIR(V1_ALLOCATOR mesos/v1/allocator/allocator) +PROTOC_TO_INCLUDE_DIR(V1_EXECUTOR mesos/v1/executor/executor) +PROTOC_TO_INCLUDE_DIR(V1_MAINTENANCE mesos/v1/maintenance/maintenance) +PROTOC_TO_INCLUDE_DIR(V1_MASTER mesos/v1/master/master) +PROTOC_TO_INCLUDE_DIR(V1_MESOS mesos/v1/mesos) +PROTOC_TO_INCLUDE_DIR(V1_QUOTA mesos/v1/quota/quota) +PROTOC_TO_INCLUDE_DIR(V1_RESOURCE_PROVIDER mesos/v1/resource_provider/resource_provider) +PROTOC_TO_INCLUDE_DIR(V1_SCHEDULER mesos/v1/scheduler/scheduler) PROTOC_TO_SRC_DIR(INTERNAL_FLAGS messages/flags) PROTOC_TO_SRC_DIR(INTERNAL_LOG messages/log) @@ -81,6 +83,7 @@ set(PUBLIC_PROTOBUF_SRC ${OCI_SPEC_PROTO_CC} ${OVERSUBSCRIPTION_PROTO_CC} ${QUOTA_PROTO_CC} + ${RESOURCE_PROVIDER_CC} ${SCHEDULER_PROTO_CC} ${STATE_PROTO_CC} ${URI_PROTO_CC} @@ -91,6 +94,7 @@ set(PUBLIC_PROTOBUF_SRC ${V1_MASTER_PROTO_CC} ${V1_MESOS_PROTO_CC} ${V1_QUOTA_PROTO_CC} + ${V1_RESOURCE_PROVIDER_CC} ${V1_SCHEDULER_PROTO_CC} ) http://git-wip-us.apache.org/repos/asf/mesos/blob/ea09704c/src/Makefile.am ---------------------------------------------------------------------- diff --git a/src/Makefile.am b/src/Makefile.am index 071656a..e41b55c 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -242,6 +242,7 @@ MESOS_PROTO = $(top_srcdir)/include/mesos/mesos.proto MODULE_PROTO = $(top_srcdir)/include/mesos/module/module.proto OCI_SPEC_PROTO = $(top_srcdir)/include/mesos/oci/spec.proto QUOTA_PROTO = $(top_srcdir)/include/mesos/quota/quota.proto +RESOURCE_PROVIDER_PROTO = $(top_srcdir)/include/mesos/resource_provider/resource_provider.proto SCHEDULER_PROTO = $(top_srcdir)/include/mesos/scheduler/scheduler.proto STATE_PROTO = $(top_srcdir)/include/mesos/state/state.proto OVERSUBSCRIPTION_PROTO = $(top_srcdir)/include/mesos/slave/oversubscription.proto @@ -253,6 +254,7 @@ V1_MAINTENANCE_PROTO = $(top_srcdir)/include/mesos/v1/maintenance/maintenance.pr V1_MASTER_PROTO = $(top_srcdir)/include/mesos/v1/master/master.proto V1_MESOS_PROTO = $(top_srcdir)/include/mesos/v1/mesos.proto V1_QUOTA_PROTO = $(top_srcdir)/include/mesos/v1/quota/quota.proto +V1_RESOURCE_PROVIDER_PROTO = $(top_srcdir)/include/mesos/v1/resource_provider/resource_provider.proto V1_SCHEDULER_PROTO = $(top_srcdir)/include/mesos/v1/scheduler/scheduler.proto @@ -293,6 +295,8 @@ CXX_PROTOS = \ ../include/mesos/oci/spec.pb.h \ ../include/mesos/quota/quota.pb.cc \ ../include/mesos/quota/quota.pb.h \ + ../include/mesos/resource_provider/resource_provider.pb.cc \ + ../include/mesos/resource_provider/resource_provider.pb.h \ ../include/mesos/scheduler/scheduler.pb.cc \ ../include/mesos/scheduler/scheduler.pb.h \ ../include/mesos/slave/containerizer.pb.cc \ @@ -317,6 +321,8 @@ CXX_PROTOS = \ ../include/mesos/v1/master/master.pb.h \ ../include/mesos/v1/quota/quota.pb.cc \ ../include/mesos/v1/quota/quota.pb.h \ + ../include/mesos/v1/resource_provider/resource_provider.pb.cc \ + ../include/mesos/v1/resource_provider/resource_provider.pb.h \ ../include/mesos/v1/scheduler/scheduler.pb.cc \ ../include/mesos/v1/scheduler/scheduler.pb.h @@ -680,6 +686,15 @@ quota_HEADERS = \ nodist_quota_HEADERS = \ ../include/mesos/quota/quota.pb.h +resourceproviderdir = $(pkgincludedir)/resource_provider + +resourceprovider_HEADERS = \ + $(top_srcdir)/include/mesos/resource_provider/resource_provider.hpp \ + $(top_srcdir)/include/mesos/resource_provider/resource_provider.proto + +nodist_resourceprovider_HEADERS = \ + ../include/mesos/resource_provider/resource_provider.pb.h + schedulerdir = $(pkgincludedir)/scheduler scheduler_HEADERS = \ @@ -798,6 +813,15 @@ v1quota_HEADERS = \ nodist_v1quota_HEADERS = \ ../include/mesos/v1/quota/quota.pb.h +v1resourceproviderdir = $(pkgincludedir)/v1/resource_provider + +v1resourceprovider_HEADERS = \ + $(top_srcdir)/include/mesos/v1/resource_provider/resource_provider.hpp \ + $(top_srcdir)/include/mesos/v1/resource_provider/resource_provider.proto + +nodist_v1resourceprovider_HEADERS = \ + ../include/mesos/v1/resource_provider/resource_provider.pb.h + v1schedulerdir = $(pkgincludedir)/v1/scheduler v1scheduler_HEADERS = \
