From dev-return-122-archive-asf-public=cust-asf.ponee.io@yunikorn.apache.org Sat Feb 22 00:08:25 2020 Return-Path: X-Original-To: archive-asf-public@cust-asf.ponee.io Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [207.244.88.153]) by mx-eu-01.ponee.io (Postfix) with SMTP id F1C12180657 for ; Sat, 22 Feb 2020 01:08:24 +0100 (CET) Received: (qmail 93155 invoked by uid 500); 22 Feb 2020 00:08:24 -0000 Mailing-List: contact dev-help@yunikorn.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@yunikorn.apache.org Delivered-To: mailing list dev@yunikorn.apache.org Received: (qmail 93138 invoked by uid 99); 22 Feb 2020 00:08:24 -0000 Received: from ec2-52-202-80-70.compute-1.amazonaws.com (HELO gitbox.apache.org) (52.202.80.70) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 22 Feb 2020 00:08:24 +0000 From: GitBox To: dev@yunikorn.apache.org Subject: [GitHub] [incubator-yunikorn-k8shim] yangwwei commented on a change in pull request #72: Add ability to support 3rd party K8s operator integration Message-ID: <158233010420.26213.15634590028437478064.gitbox@gitbox.apache.org> References: In-Reply-To: Date: Sat, 22 Feb 2020 00:08:24 -0000 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit yangwwei commented on a change in pull request #72: Add ability to support 3rd party K8s operator integration URL: https://github.com/apache/incubator-yunikorn-k8shim/pull/72#discussion_r382861039 ########## File path: pkg/appmgmt/interfaces/amprotocol.go ########## @@ -0,0 +1,83 @@ +/* + 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. +*/ + +package interfaces + +import ( + v1 "k8s.io/api/core/v1" +) + +// app management protocol defines all the APIs needed for app management, +// this is the protocol between scheduler cache and app management plugins +type ApplicationManagementProtocol interface { + // returns app that already existed in the cache, + // or nil, false if app with the given appID is not found + GetApplication(appID string) (ManagedApp, bool) Review comment: it makes sense, bool is not needed. ``` Sometimes you need to distinguish a missing entry from a zero value. Is there an entry for "UTC" or is that 0 because it's not in the map at all? You can discriminate with a form of multiple assignment. var seconds int var ok bool seconds, ok = timeZone[tz] For obvious reasons this is called the “comma ok” idiom. ``` ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: users@infra.apache.org With regards, Apache Git Services --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscribe@yunikorn.apache.org For additional commands, e-mail: dev-help@yunikorn.apache.org