repo_name
stringlengths
6
101
path
stringlengths
4
300
text
stringlengths
7
1.31M
luoshengming/MyReadings
books/fpinjava/fpinjava-parent/fpinjava-usingfunctions-solutions/src/test/java/com/fpinjava/functions/exercise02_12/FunctionExamplesTest.java
package com.fpinjava.functions.exercise02_12; import org.junit.Test; import static com.fpinjava.functions.exercise02_12.FunctionExamples.factorial0; import static com.fpinjava.functions.exercise02_12.FunctionExamples.factorial1; import static org.junit.Assert.assertEquals; public class FunctionExamplesTest { @Test public void test() { assertEquals(Integer.valueOf(3628800), factorial0.apply(10)); assertEquals(Integer.valueOf(3628800), factorial1.apply(10)); FunctionExamples x = new FunctionExamples(); assertEquals(Integer.valueOf(3628800), x.factorial2.apply(10)); assertEquals(Integer.valueOf(3628800), x.factorial3.apply(10)); } }
NicolasJudalet/connexions
gatsby-config.js
/** * Configure your Gatsby site with this file. * * See: https://www.gatsbyjs.org/docs/gatsby-config/ */ require("dotenv").config({ path: ".env", }) const { spaceId, accessToken } = process.env module.exports = { plugins: [ { resolve: "gatsby-source-contentful", options: { spaceId, accessToken, }, }, { resolve: "gatsby-plugin-manifest", options: { icon: "assets/america-icon.png", start_url: "/", }, }, "gatsby-plugin-resolve-src", "gatsby-transformer-sharp", "gatsby-plugin-sharp", "gatsby-plugin-styled-components", ], }
samkusin/overview
Engine/Tasks/LoadFile.hpp
// // LoadFile.hpp // EnginePrototype // // Created by <NAME> on 11/30/15. // // #ifndef Oveview_Task_LoadFile_hpp #define Oveview_Task_LoadFile_hpp #include <cinek/allocator.hpp> #include <cinek/task.hpp> #include <ckio/file.h> #include <vector> #include <string> namespace cinek { namespace ove { class LoadFile : public Task { public: static const UUID kUUID; LoadFile(EndCallback cb) : Task(cb), _file(nullptr) {} LoadFile(std::string name, EndCallback cb=0); virtual ~LoadFile(); void setName(std::string name) { _name = name; } const uint8_t* buffer() const { return _buffer; } uint32_t size() const { return _size; } const std::string& name() const { return _name; } virtual const TaskClassId& classId() const override { return kUUID; } virtual void onFileLoaded(); protected: virtual void onBegin() override; virtual void onUpdate(uint32_t deltaTimeMs) override; virtual void onCancel() override; virtual uint8_t* acquireBuffer(uint32_t size) = 0; virtual bool retry(std::string& path) { return false; } private: void close(); std::string _name; uint8_t* _buffer; uint32_t _size; ckio_handle *_file; }; } /* namespace ove */ } /* namespace cinek */ #endif /* LoadFile_hpp */
rmartinc/keycloak
saml-core/src/main/java/org/keycloak/saml/processing/core/parsers/saml/metadata/SAMLAuthzServiceParser.java
<reponame>rmartinc/keycloak package org.keycloak.saml.processing.core.parsers.saml.metadata; /** * @author mhajas */ public class SAMLAuthzServiceParser extends SAMLEndpointTypeParser { private static final SAMLAuthzServiceParser INSTANCE = new SAMLAuthzServiceParser(); public SAMLAuthzServiceParser() { super(SAMLMetadataQNames.AUTHZ_SERVICE); } public static SAMLAuthzServiceParser getInstance() { return INSTANCE; } }
hahs-92/ddd-sofkau-reto
src/main/java/co/com/webSchoolddd/registro/Escuela/command/RemoverReto.java
<reponame>hahs-92/ddd-sofkau-reto package co.com.webSchoolddd.registro.Escuela.command; import co.com.sofka.domain.generic.Command; import co.com.webSchoolddd.registro.Escuela.valor.EscuelaId; import co.com.webSchoolddd.registro.Escuela.valor.RetoId; public class RemoverReto extends Command { private final EscuelaId escuelaId; private final RetoId retoId; public RemoverReto(EscuelaId escuelaId, RetoId retoId) { this.escuelaId = escuelaId; this.retoId = retoId; } public EscuelaId getEscuelaId() { return escuelaId; } public RetoId getRetoId() { return retoId; } }
supertech-999/ReactJS-Phonegap
app/src/flux/constants/lang.js
var ReactFlux = require('react-flux'); module.exports = ReactFlux.createConstants([ 'SET_LOCALE' ], 'LANG');
ahmadabudames/data-structures-and-algorithms
python/code_challenges/tree_intersection/tree_intersection/linkedList.py
class Node: def __init__(self, value): self.value = value self.next = None class LinkedList: def __init__(self): self.head = None def add(self, value): new_node = Node(value) if not self.head: self.head = new_node else: new_node.next = self.head self.head = new_node
sizeofvoid/ifconfigd
usr/src/sys/arch/sparc64/sparc64/ofw_machdep.c
<reponame>sizeofvoid/ifconfigd /* $OpenBSD: ofw_machdep.c,v 1.31 2009/02/19 11:12:42 kettenis Exp $ */ /* $NetBSD: ofw_machdep.c,v 1.16 2001/07/20 00:07:14 eeh Exp $ */ /* * Copyright (C) 1996 <NAME>. * Copyright (C) 1996 TooLs GmbH. * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. All advertising materials mentioning features or use of this software * must display the following acknowledgement: * This product includes software developed by TooLs GmbH. * 4. The name of TooLs GmbH may not be used to endorse or promote products * derived from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY TOOLS GMBH ``AS IS'' AND ANY EXPRESS OR * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. * IN NO EVENT SHALL TOOLS GMBH BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #include <sys/param.h> #include <sys/buf.h> #include <sys/conf.h> #include <sys/device.h> #include <sys/disk.h> #include <sys/disklabel.h> #include <sys/fcntl.h> #include <sys/ioctl.h> #include <sys/malloc.h> #include <sys/stat.h> #include <sys/systm.h> #include <machine/openfirm.h> #include <dev/ofw/ofw_pci.h> #if defined(FFS) && defined(CD9660) #include <ufs/ffs/fs.h> #endif /* * Note that stdarg.h and the ANSI style va_start macro is used for both * ANSI and traditional C compilers. */ #include <sys/stdarg.h> #include <machine/sparc64.h> int vsprintf(char *, const char *, va_list); void dk_cleanup(void); static u_int mmuh = -1, memh = -1; static u_int get_mmu_handle(void); static u_int get_memory_handle(void); static u_int get_mmu_handle() { u_int chosen; if ((chosen = OF_finddevice("/chosen")) == -1) { prom_printf("get_mmu_handle: cannot get /chosen\r\n"); return -1; } if (OF_getprop(chosen, "mmu", &mmuh, sizeof(mmuh)) == -1) { prom_printf("get_mmu_handle: cannot get mmuh\r\n"); return -1; } return mmuh; } static u_int get_memory_handle() { u_int chosen; if ((chosen = OF_finddevice("/chosen")) == -1) { prom_printf("get_memory_handle: cannot get /chosen\r\n"); return -1; } if (OF_getprop(chosen, "memory", &memh, sizeof(memh)) == -1) { prom_printf("get_memory_handle: cannot get memh\r\n"); return -1; } return memh; } /* * Point prom to our trap table. This stops the prom from mapping us. */ int prom_set_trap_table(tba, mmfsa) vaddr_t tba; paddr_t mmfsa; { struct { cell_t name; cell_t nargs; cell_t nreturns; cell_t tba; cell_t mmfsa; } args; args.name = ADR2CELL("SUNW,set-trap-table"); if (CPU_ISSUN4V) args.nargs = 2; else args.nargs = 1; args.nreturns = 0; args.tba = ADR2CELL(tba); args.mmfsa = ADR2CELL(mmfsa); return openfirmware(&args); } /* * Have the prom convert from virtual to physical addresses. * * Only works while the prom is actively mapping us. */ paddr_t prom_vtop(vaddr) vaddr_t vaddr; { struct { cell_t name; cell_t nargs; cell_t nreturns; cell_t method; cell_t ihandle; cell_t vaddr; cell_t status; cell_t retaddr; cell_t mode; cell_t phys_hi; cell_t phys_lo; } args; if (mmuh == -1 && ((mmuh = get_mmu_handle()) == -1)) { prom_printf("prom_vtop: cannot get mmuh\r\n"); return 0; } args.name = ADR2CELL("call-method"); args.nargs = 3; args.nreturns = 5; args.method = ADR2CELL("translate"); args.ihandle = HDL2CELL(mmuh); args.vaddr = ADR2CELL(vaddr); if(openfirmware(&args) == -1) return -1; #if 0 prom_printf("Called \"translate\", mmuh=%x, vaddr=%x, " "status=%x %x,\r\n " "retaddr=%x %x, " "mode=%x %x, " "phys_hi=%x %x, " "phys_lo=%x %x\r\n", mmuh, vaddr, (int)(args.status>>32), (int)args.status, (int)(args.retaddr>>32), (int)args.retaddr, (int)(args.mode>>32), (int)args.mode, (int)(args.phys_hi>>32), (int)args.phys_hi, (int)(args.phys_lo>>32), (int)args.phys_lo); #endif return (paddr_t)CELL2HDQ(args.phys_hi, args.phys_lo); } /* * Grab some address space from the prom * * Only works while the prom is actively mapping us. */ vaddr_t prom_claim_virt(vaddr, len) vaddr_t vaddr; int len; { struct { cell_t name; cell_t nargs; cell_t nreturns; cell_t method; cell_t ihandle; cell_t align; cell_t len; cell_t vaddr; cell_t status; cell_t retaddr; } args; if (mmuh == -1 && ((mmuh = get_mmu_handle()) == -1)) { prom_printf("prom_claim_virt: cannot get mmuh\r\n"); return 0; } args.name = ADR2CELL("call-method"); args.nargs = 5; args.nreturns = 2; args.method = ADR2CELL("claim"); args.ihandle = HDL2CELL(mmuh); args.align = 0; args.len = len; args.vaddr = ADR2CELL(vaddr); if (openfirmware(&args) == -1) return -1; return (paddr_t)args.retaddr; } /* * Request some address space from the prom * * Only works while the prom is actively mapping us. */ vaddr_t prom_alloc_virt(len, align) int len; int align; { struct { cell_t name; cell_t nargs; cell_t nreturns; cell_t method; cell_t ihandle; cell_t align; cell_t len; cell_t status; cell_t retaddr; } args; if (mmuh == -1 && ((mmuh = get_mmu_handle()) == -1)) { prom_printf("prom_alloc_virt: cannot get mmuh\r\n"); return -1LL; } args.name = ADR2CELL("call-method"); args.nargs = 4; args.nreturns = 2; args.method = ADR2CELL("claim"); args.ihandle = HDL2CELL(mmuh); args.align = align; args.len = len; if (openfirmware(&args) != 0) return -1; return (vaddr_t)args.retaddr; } /* * Release some address space to the prom * * Only works while the prom is actively mapping us. */ int prom_free_virt(vaddr, len) vaddr_t vaddr; int len; { struct { cell_t name; cell_t nargs; cell_t nreturns; cell_t method; cell_t ihandle; cell_t len; cell_t vaddr; } args; if (mmuh == -1 && ((mmuh = get_mmu_handle()) == -1)) { prom_printf("prom_free_virt: cannot get mmuh\r\n"); return -1; } args.name = ADR2CELL("call-method"); args.nargs = 4; args.nreturns = 0; args.method = ADR2CELL("release"); args.ihandle = HDL2CELL(mmuh); args.vaddr = ADR2CELL(vaddr); args.len = len; return openfirmware(&args); } /* * Unmap some address space * * Only works while the prom is actively mapping us. */ int prom_unmap_virt(vaddr, len) vaddr_t vaddr; int len; { struct { cell_t name; cell_t nargs; cell_t nreturns; cell_t method; cell_t ihandle; cell_t len; cell_t vaddr; } args; if (mmuh == -1 && ((mmuh = get_mmu_handle()) == -1)) { prom_printf("prom_unmap_virt: cannot get mmuh\r\n"); return -1; } args.name = ADR2CELL("call-method"); args.nargs = 4; args.nreturns = 0; args.method = ADR2CELL("unmap"); args.ihandle = HDL2CELL(mmuh); args.vaddr = ADR2CELL(vaddr); args.len = len; return openfirmware(&args); } /* * Have prom map in some memory * * Only works while the prom is actively mapping us. */ int prom_map_phys(paddr, size, vaddr, mode) paddr_t paddr; off_t size; vaddr_t vaddr; int mode; { struct { cell_t name; cell_t nargs; cell_t nreturns; cell_t method; cell_t ihandle; cell_t mode; cell_t size; cell_t vaddr; cell_t phys_hi; cell_t phys_lo; cell_t status; cell_t retaddr; } args; if (mmuh == -1 && ((mmuh = get_mmu_handle()) == -1)) { prom_printf("prom_map_phys: cannot get mmuh\r\n"); return 0; } args.name = ADR2CELL("call-method"); args.nargs = 7; args.nreturns = 1; args.method = ADR2CELL("map"); args.ihandle = HDL2CELL(mmuh); args.mode = mode; args.size = size; args.vaddr = ADR2CELL(vaddr); args.phys_hi = HDQ2CELL_HI(paddr); args.phys_lo = HDQ2CELL_LO(paddr); if (openfirmware(&args) == -1) return -1; if (args.status) return -1; return (int)args.retaddr; } /* * Request some RAM from the prom * * Only works while the prom is actively mapping us. */ paddr_t prom_alloc_phys(len, align) int len; int align; { struct { cell_t name; cell_t nargs; cell_t nreturns; cell_t method; cell_t ihandle; cell_t align; cell_t len; cell_t status; cell_t phys_hi; cell_t phys_lo; } args; if (memh == -1 && ((memh = get_memory_handle()) == -1)) { prom_printf("prom_alloc_phys: cannot get memh\r\n"); return -1; } args.name = ADR2CELL("call-method"); args.nargs = 4; args.nreturns = 3; args.method = ADR2CELL("claim"); args.ihandle = HDL2CELL(memh); args.align = align; args.len = len; if (openfirmware(&args) != 0) return -1; return (paddr_t)CELL2HDQ(args.phys_hi, args.phys_lo); } /* * Request some specific RAM from the prom * * Only works while the prom is actively mapping us. */ paddr_t prom_claim_phys(phys, len) paddr_t phys; int len; { struct { cell_t name; cell_t nargs; cell_t nreturns; cell_t method; cell_t ihandle; cell_t align; cell_t len; cell_t phys_hi; cell_t phys_lo; cell_t status; cell_t rphys_hi; cell_t rphys_lo; } args; if (memh == -1 && ((memh = get_memory_handle()) == -1)) { prom_printf("prom_claim_phys: cannot get memh\r\n"); return -1; } args.name = ADR2CELL("call-method"); args.nargs = 6; args.nreturns = 3; args.method = ADR2CELL("claim"); args.ihandle = HDL2CELL(memh); args.align = 0; args.len = len; args.phys_hi = HDQ2CELL_HI(phys); args.phys_lo = HDQ2CELL_LO(phys); if (openfirmware(&args) != 0) return -1; return (paddr_t)CELL2HDQ(args.rphys_hi, args.rphys_lo); } /* * Free some RAM to prom * * Only works while the prom is actively mapping us. */ int prom_free_phys(phys, len) paddr_t phys; int len; { struct { cell_t name; cell_t nargs; cell_t nreturns; cell_t method; cell_t ihandle; cell_t len; cell_t phys_hi; cell_t phys_lo; } args; if (memh == -1 && ((memh = get_memory_handle()) == -1)) { prom_printf("prom_free_phys: cannot get memh\r\n"); return -1; } args.name = ADR2CELL("call-method"); args.nargs = 5; args.nreturns = 0; args.method = ADR2CELL("release"); args.ihandle = HDL2CELL(memh); args.len = len; args.phys_hi = HDQ2CELL_HI(phys); args.phys_lo = HDQ2CELL_LO(phys); return openfirmware(&args); } /* * Get the msgbuf from the prom. Only works once. * * Only works while the prom is actively mapping us. */ paddr_t prom_get_msgbuf(len, align) int len; int align; { struct { cell_t name; cell_t nargs; cell_t nreturns; cell_t method; cell_t ihandle; cell_t align; cell_t len; cell_t id; cell_t status; cell_t phys_hi; cell_t phys_lo; } args; paddr_t addr; int rooth; int is_e250 = 1; /* E250s tend to have buggy PROMs that break on test-method */ if ((rooth = OF_finddevice("/")) != -1) { char name[80]; if ((OF_getprop(rooth, "name", &name, sizeof(name))) != -1) { if (strcmp(name, "SUNW,Ultra-250") && strcmp(name, "SUNW,Ultra-4")) is_e250 = 0; } else prom_printf("prom_get_msgbuf: cannot get \"name\"\r\n"); } else prom_printf("prom_get_msgbuf: cannot open root device \r\n"); if (memh == -1 && ((memh = get_memory_handle()) == -1)) { prom_printf("prom_get_msgbuf: cannot get memh\r\n"); return -1; } if (is_e250) { prom_printf("prom_get_msgbuf: Cannot recover msgbuf on E250/450\r\n"); } else if (OF_test("test-method") == 0) { if (OF_test_method(memh, "SUNW,retain") != 0) { args.name = ADR2CELL("call-method"); args.nargs = 5; args.nreturns = 3; args.method = ADR2CELL("SUNW,retain"); args.id = ADR2CELL("msgbuf"); args.ihandle = HDL2CELL(memh); args.len = len; args.align = align; args.status = -1; if (openfirmware(&args) == 0 && args.status == 0) return (paddr_t)CELL2HDQ(args.phys_hi, args.phys_lo); prom_printf("prom_get_msgbuf: SUNW,retain failed\r\n"); } else prom_printf("prom_get_msgbuf: test-method failed\r\n"); } else prom_printf("prom_get_msgbuf: test failed\r\n"); /* Allocate random memory -- page zero avail?*/ addr = prom_claim_phys(0x000, len); prom_printf("prom_get_msgbuf: allocated new buf at %08x\r\n", (int)addr); if (addr == -1) { prom_printf("prom_get_msgbuf: cannot get allocate physmem\r\n"); return -1; } prom_printf("prom_get_msgbuf: claiming new buf at %08x\r\n", (int)addr); { int i; for (i=0; i<200000000; i++); } return addr; /* Kluge till we go 64-bit */ } int prom_itlb_load(int index, u_int64_t data, vaddr_t vaddr) { static struct { cell_t name; cell_t nargs; cell_t nreturns; cell_t method; cell_t ihandle; cell_t vaddr; cell_t data; cell_t index; cell_t status; } args; if (mmuh == -1 && ((mmuh = get_mmu_handle()) == -1)) { prom_printf("prom_itlb_load: cannot get mmuh\r\n"); return 0; } args.name = ADR2CELL("call-method"); args.nargs = 5; args.nreturns = 1; args.method = ADR2CELL("SUNW,itlb-load"); args.ihandle = HDL2CELL(mmuh); args.vaddr = ADR2CELL(vaddr); args.data = data; args.index = index; if(openfirmware(&args) == -1) return -1; if (args.status) return -1; return 0; } int prom_dtlb_load(int index, u_int64_t data, vaddr_t vaddr) { static struct { cell_t name; cell_t nargs; cell_t nreturns; cell_t method; cell_t ihandle; cell_t vaddr; cell_t data; cell_t index; cell_t status; } args; if (mmuh == -1 && ((mmuh = get_mmu_handle()) == -1)) { prom_printf("prom_itlb_load: cannot get mmuh\r\n"); return 0; } args.name = ADR2CELL("call-method"); args.nargs = 5; args.nreturns = 1; args.method = ADR2CELL("SUNW,dtlb-load"); args.ihandle = HDL2CELL(mmuh); args.vaddr = ADR2CELL(vaddr); args.data = data; args.index = index; if(openfirmware(&args) == -1) return -1; if (args.status) return -1; return 0; } #ifdef MULTIPROCESSOR /* * Start secondary cpu, arrange 'func' as the entry. */ void prom_start_cpu(int cpu, void *func, long arg) { static struct { cell_t name; cell_t nargs; cell_t nreturns; cell_t cpu; cell_t func; cell_t arg; } args; args.name = ADR2CELL("SUNW,start-cpu"); args.nargs = 3; args.nreturns = 0; args.cpu = HDL2CELL(cpu); args.func = ADR2CELL(func); args.arg = arg; openfirmware(&args); } void prom_start_cpu_by_cpuid(int cpu, void *func, long arg) { static struct { cell_t name; cell_t nargs; cell_t nreturns; cell_t cpu; cell_t func; cell_t arg; cell_t status; } args; args.name = ADR2CELL("SUNW,start-cpu-by-cpuid"); args.nargs = 3; args.nreturns = 1; args.cpu = cpu; args.func = ADR2CELL(func); args.arg = arg; openfirmware(&args); } #endif /* * Low-level prom I/O routines. */ static u_int stdin = 0; static u_int stdout = 0; int OF_stdin() { u_int chosen; if (stdin != 0) return stdin; chosen = OF_finddevice("/chosen"); OF_getprop(chosen, "stdin", &stdin, sizeof(stdin)); return stdin; } int OF_stdout() { u_int chosen; if (stdout != 0) return stdout; chosen = OF_finddevice("/chosen"); OF_getprop(chosen, "stdout", &stdout, sizeof(stdout)); return stdout; } /* * print debug info to prom. * This is not safe, but then what do you expect? */ void prom_printf(const char *fmt, ...) { int len; static char buf[256]; va_list ap; va_start(ap, fmt); len = vsnprintf(buf, sizeof buf, fmt, ap); if (len == -1) len = 0; else if (len >= sizeof buf) len = sizeof buf - 1; va_end(ap); OF_write(OF_stdout(), buf, len); } const char * prom_serengeti_set_console_input(const char *new) { static struct { cell_t name; cell_t nargs; cell_t nreturns; cell_t new; cell_t old; } args; args.name = ADR2CELL("SUNW,set-console-input"); args.nargs = 1; args.nreturns = 1; args.new = ADR2CELL(new); if (openfirmware(&args) == -1) return NULL; return (const char *)args.old; } time_t prom_opl_get_tod(void) { static struct { cell_t name; cell_t nargs; cell_t nreturns; cell_t stick; cell_t time; } args; args.name = ADR2CELL("FJSV,get-tod"); args.nargs = 0; args.nreturns = 2; if (openfirmware(&args) == -1) return (time_t)-1; return (time_t)args.time; } uint64_t prom_set_sun4v_api_version(uint64_t api_group, uint64_t major, uint64_t minor, uint64_t *supported_minor) { static struct { cell_t name; cell_t nargs; cell_t nreturns; cell_t api_group; cell_t major; cell_t minor; cell_t status; cell_t supported_minor; } args; args.name = ADR2CELL("SUNW,set-sun4v-api-version"); args.nargs = 3; args.nreturns = 2; args.api_group = api_group; args.major = major; args.minor = minor; args.status = -1; args.supported_minor = -1; openfirmware(&args); *supported_minor = args.supported_minor; return (uint64_t)args.status; } void prom_sun4v_soft_state_supported(void) { static struct { cell_t name; cell_t nargs; cell_t nreturns; } args; args.name = ADR2CELL("SUNW,soft-state-supported"); args.nargs = 0; args.nreturns = 0; openfirmware(&args); } #ifdef DEBUG int ofmapintrdebug = 0; #define DPRINTF(x) do { if (ofmapintrdebug) printf x; } while (0) #else #define DPRINTF(x) #endif /* * Recursively hunt for a property. */ int OF_searchprop(int node, char *prop, void *buf, int buflen) { int len; for( ; node; node = OF_parent(node)) { len = OF_getprop(node, prop, buf, buflen); if (len >= 0) return (len); } /* Error -- not found */ return (-1); } /* * Compare a sequence of cells with a mask, * return 1 if they match and 0 if they don't. */ static int compare_cells (int *cell1, int *cell2, int *mask, int ncells); static int compare_cells(int *cell1, int *cell2, int *mask, int ncells) { int i; for (i=0; i<ncells; i++) { DPRINTF(("src %x ^ dest %x -> %x & mask %x -> %x\n", cell1[i], cell2[i], (cell1[i] ^ cell2[i]), mask[i], ((cell1[i] ^ cell2[i]) & mask[i]))); if (((cell1[i] ^ cell2[i]) & mask[i]) != 0) return (0); } return (1); } /* * Find top pci bus host controller for a node. */ static int find_pci_host_node(int node) { char dev_type[16]; int pch = 0; int len; for (; node; node = OF_parent(node)) { len = OF_getprop(node, "device_type", &dev_type, sizeof(dev_type)); if (len <= 0) continue; if (strcmp(dev_type, "pci") == 0 || strcmp(dev_type, "pciex") == 0) pch = node; } return pch; } /* * Follow the OFW algorithm and return an interrupt specifier. * * Pass in the interrupt specifier you want mapped and the node * you want it mapped from. validlen is the number of cells in * the interrupt specifier, and buflen is the number of cells in * the buffer. */ int OF_mapintr(int node, int *interrupt, int validlen, int buflen) { int i, len; int address_cells, size_cells, interrupt_cells, interrupt_map_len; int interrupt_map[256]; int interrupt_map_mask[10]; int reg[10]; char dev_type[32]; int phc_node; int rc = -1; /* * Don't try to map interrupts for onboard devices, or if the * interrupt is already fully specified. */ if (*interrupt & 0x20 || *interrupt & 0x7c0) return validlen; /* * If there is no interrupt map in the bus node, we * need to convert the slot address to its parent * bus format, and hunt up the parent bus to see if * we need to remap. * * The specification for interrupt mapping is borken. * You are supposed to query the interrupt parent in * the interrupt-map specification to determine the * number of address and interrupt cells, but we need * to know how many address and interrupt cells to skip * to find the phandle... * */ if ((len = OF_getprop(node, "reg", &reg, sizeof(reg))) <= 0) { printf("OF_mapintr: no reg property?\n"); return (-1); } phc_node = find_pci_host_node(node); while (node) { #ifdef DEBUG char name[40]; if (ofmapintrdebug) { OF_getprop(node, "name", &name, sizeof(name)); printf("Node %s (%x), host %x\n", name, node, phc_node); } #endif if ((interrupt_map_len = OF_getprop(node, "interrupt-map", &interrupt_map, sizeof(interrupt_map))) <= 0) { /* Swizzle interrupt if this is a PCI bridge. */ if (((len = OF_getprop(node, "device_type", &dev_type, sizeof(dev_type))) > 0) && (strcmp(dev_type, "pci") == 0 || strcmp(dev_type, "pciex") == 0) && (node != phc_node)) { *interrupt = ((*interrupt + OFW_PCI_PHYS_HI_DEVICE(reg[0]) - 1) & 3) + 1; DPRINTF(("OF_mapintr: interrupt %x, reg[0] %x\n", *interrupt, reg[0])); } /* Get reg for next level compare. */ reg[0] = 0; OF_getprop(node, "reg", &reg, sizeof(reg)); node = OF_parent(node); continue; } /* Convert from bytes to cells. */ interrupt_map_len = interrupt_map_len/sizeof(int); if ((len = (OF_searchprop(node, "#address-cells", &address_cells, sizeof(address_cells)))) <= 0) { /* How should I know. */ address_cells = 2; } DPRINTF(("#address-cells = %d len %d", address_cells, len)); if ((len = OF_searchprop(node, "#size-cells", &size_cells, sizeof(size_cells))) <= 0) { /* How should I know. */ size_cells = 2; } DPRINTF(("#size-cells = %d len %d", size_cells, len)); if ((len = OF_getprop(node, "#interrupt-cells", &interrupt_cells, sizeof(interrupt_cells))) <= 0) { /* How should I know. */ interrupt_cells = 1; } DPRINTF(("#interrupt-cells = %d, len %d\n", interrupt_cells, len)); if ((len = OF_getprop(node, "interrupt-map-mask", &interrupt_map_mask, sizeof(interrupt_map_mask))) <= 0) { /* Create a mask that masks nothing. */ for (i = 0; i<(address_cells + interrupt_cells); i++) interrupt_map_mask[i] = -1; } #ifdef DEBUG DPRINTF(("interrupt-map-mask len %d = ", len)); for (i=0; i<(address_cells + interrupt_cells); i++) DPRINTF(("%x.", interrupt_map_mask[i])); DPRINTF(("reg = ")); for (i=0; i<(address_cells); i++) DPRINTF(("%x.", reg[i])); DPRINTF(("interrupts = ")); for (i=0; i<(interrupt_cells); i++) DPRINTF(("%x.", interrupt[i])); #endif /* Finally we can attempt the compare. */ i = 0; while (i < interrupt_map_len + address_cells + interrupt_cells) { int pintr_cells; int *imap = &interrupt_map[i]; int *parent = &imap[address_cells + interrupt_cells]; #ifdef DEBUG DPRINTF(("\ninterrupt-map addr (a %d, i %d p %p) ", address_cells, interrupt_cells, parent)); for (len=0; len<address_cells; len++) DPRINTF(("%x.", imap[len])); DPRINTF((" intr ")); for (; len<(address_cells+interrupt_cells); len++) DPRINTF(("%x.", imap[len])); DPRINTF(("\nnode %x vs parent %x\n", imap[len], *parent)); #endif /* Find out how many cells we'll need to skip. */ if ((len = OF_searchprop(*parent, "#interrupt-cells", &pintr_cells, sizeof(pintr_cells))) < 0) { pintr_cells = interrupt_cells; } DPRINTF(("pintr_cells = %d len %d\n", pintr_cells, len)); if (compare_cells(imap, reg, interrupt_map_mask, address_cells) && compare_cells(&imap[address_cells], interrupt, &interrupt_map_mask[address_cells], interrupt_cells)) { /* Bingo! */ if (buflen < pintr_cells) { /* Error -- ran out of storage. */ return (-1); } node = *parent; parent++; #ifdef DEBUG DPRINTF(("Match! using ")); for (len=0; len<pintr_cells; len++) DPRINTF(("%x.", parent[len])); #endif for (i=0; i<pintr_cells; i++) interrupt[i] = parent[i]; rc = validlen = pintr_cells; if (node == phc_node) return (rc); break; } /* Move on to the next interrupt_map entry. */ #ifdef DEBUG DPRINTF(("skip %d cells:", address_cells + interrupt_cells + pintr_cells + 1)); for (len=0; len<(address_cells + interrupt_cells + pintr_cells + 1); len++) DPRINTF(("%x.", imap[len])); #endif i += address_cells + interrupt_cells + pintr_cells + 1; } /* Get reg for the next level search. */ if ((len = OF_getprop(node, "reg", &reg, sizeof(reg))) <= 0) DPRINTF(("OF_mapintr: no reg property?\n")); else DPRINTF(("reg len %d\n", len)); node = OF_parent(node); } return (rc); }
renesugar/Js2Py
tests/test_cases/language/future-reserved-words/S7.6.1.2_A1.13.js
// Copyright 2009 the Sputnik authors. All rights reserved. // This code is governed by the BSD license found in the LICENSE file. /*--- info: The "float" token can be used as identifier es5id: 7.6.1.2_A1.13 description: Checking if execution of "float=1" succeeds ---*/ var float = 1;
damazz/HQCA
hqca/core/primitives/_Hamiltonian.py
from math import pi import sys ''' takes Pauli strings from qiskit aqua package, and actually adds on Hamiltonian circuit ''' def apply_clifford_operation(Q,U): def V(n): Q.qc.s(n) Q.qc.h(n) Q.qc.sdg(n) def S(n): Q.qc.s(n) cliff = { 'H':Q.qc.h, 'S':S, 'V':V, } for n,u in enumerate(U): op = cliff[u] op(n) def pauliOp(Q,loc,sigma='x',inv=False): if sigma in ['Z','z']: pass elif sigma in ['X','x']: Q.qc.rz(pi/2,Q.q[loc]) Q.qc.sx(Q.q[loc]) Q.qc.rz(pi/2,Q.q[loc]) elif sigma in ['I','i']: pass elif sigma in ['Y','y']: if inv: Q.qc.rz(pi/2,Q.q[loc]) Q.qc.sx(Q.q[loc]) Q.qc.rz(pi,Q.q[loc]) #Q.qc.rx(-pi/2,Q.q[loc]) else: #Q.qc.rx(pi/2,Q.q[loc]) Q.qc.sx(Q.q[loc]) Q.qc.rz(pi/2,Q.q[loc]) def apply_pauli_string(Q,pauli): if not abs(abs(pauli.c)-1)<1e-4: print('Pauli operator:') print(pauli) sys.exit('Can not implement partial Pauli operator in line.') for q,i in enumerate(pauli.s): if i=='X': Q.qc.x(Q.q[q]) elif i=='Y': Q.qc.rz(pi/2,Q.q[q]) Q.qc.x(Q.q[q]) Q.qc.rz(pi/2,Q.q[q]) elif i=='Z': Q.qc.rz(pi,Q.q[q]) def generic_Pauli_term(Q,val,pauli,scaling=1.0): s,c = pauli,val if len(s)==1: if s=='I': pass #Q.qc.u1(val,Q.q[0]) #Q.qc.x(Q.q[0]) #Q.qc.u1(val,Q.q[0]) #Q.qc.x(Q.q[0]) elif s=='X': Q.qc.rx(val*scaling,Q.q[0]) elif s=='Y': Q.qc.ry(val*scaling,Q.q[0]) elif s=='Z': Q.qc.rz(val*scaling,Q.q[0]) else: pauliTerms=0 ind = [] terms = [] for n,i in enumerate(s): if not i in ['I']: pauliTerms+=1 ind.append(n) terms.append(i) if pauliTerms==0: Q.qc.u1(val,Q.q[0]) Q.qc.x(Q.q[0]) Q.qc.u1(val,Q.q[0]) Q.qc.x(Q.q[0]) else: # basis for n,p in zip(ind,terms): pauliOp(Q,n,p) # exp cnot for n in range(0,pauliTerms-1): Q.qc.cx(Q.q[ind[n]],Q.q[ind[n+1]]) # parameter Q.qc.rz(val*scaling,Q.q[ind[-1]]) # exp cnot for n in reversed(range(pauliTerms-1)): Q.qc.cx(Q.q[ind[n]],Q.q[ind[n+1]]) # inv. basis for n,p in zip(ind,terms): pauliOp(Q,n,p,inv=True) def _generic_Pauli_term_qiskit(Q,term,scaling=1): ''' note input should be from qiskit entry 1 is value, entry to is a Pauli object ''' val = term[0] pauliStr = term[1].to_label()[::-1] pauliTerms=0 ind = [] terms = [] for n,i in enumerate(pauliStr): if not i in ['I','i']: pauliTerms+=1 ind.append(n) terms.append(i) if pauliTerms==0: #Q.qc.ph(val*scaling,Q.q[0]) Q.qc.u1(val,Q.q[0]) Q.qc.x(Q.q[0]) Q.qc.u1(val,Q.q[0]) Q.qc.x(Q.q[0]) else: # basis for n,p in zip(ind,terms): pauliOp(Q,n,p) # exp cnot for n in range(0,pauliTerms-1): Q.qc.cx(Q.q[ind[n]],Q.q[ind[n+1]]) # parameter Q.qc.rz(val*scaling,Q.q[ind[-1]]) # exp cnot for n in reversed(range(pauliTerms-1)): Q.qc.cx(Q.q[ind[n]],Q.q[ind[n+1]]) # inv. basis for n,p in zip(ind,terms): pauliOp(Q,n,p,inv=True)
hhgyu/webrtc-java
webrtc-demo/webrtc-demo-api/src/main/java/dev/onvoid/webrtc/demo/apprtc/AppRTCJsonCodec.java
/* * Copyright 2019 <NAME> * * 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 dev.onvoid.webrtc.demo.apprtc; import static java.util.Objects.isNull; import static java.util.Objects.nonNull; import dev.onvoid.webrtc.RTCIceCandidate; import dev.onvoid.webrtc.RTCIceServer; import dev.onvoid.webrtc.RTCSdpType; import dev.onvoid.webrtc.RTCSessionDescription; import dev.onvoid.webrtc.demo.apprtc.AppRTCMessage.Type; import java.io.StringReader; import java.io.StringWriter; import java.util.ArrayList; import java.util.List; import java.util.Map; import javax.json.Json; import javax.json.JsonArray; import javax.json.JsonArrayBuilder; import javax.json.JsonBuilderFactory; import javax.json.JsonObject; import javax.json.JsonObjectBuilder; import javax.json.JsonReader; import javax.json.JsonWriter; public class AppRTCJsonCodec { AppRTCSignalingParameters toSignalingParameters(String json) { JsonReader reader = Json.createReader(new StringReader(json)); JsonObject room = reader.readObject(); String result = room.getString("result"); if (!result.equals("SUCCESS")) { throw new RuntimeException(result); } room = room.getJsonObject("params"); String clientId = room.getString("client_id"); String wssUrl = room.getString("wss_url"); String wssPostUrl = room.getString("wss_post_url"); String iceServerUrl = room.getString("ice_server_url"); boolean initiator = Boolean.parseBoolean(room.getString("is_initiator")); List<RTCIceCandidate> iceCandidates = null; RTCSessionDescription offer = null; if (!initiator) { iceCandidates = new ArrayList<>(); JsonArray messages = room.getJsonArray("messages"); for (int i = 0; i < messages.size(); ++i) { String messageString = messages.getString(i); reader = Json.createReader(new StringReader(messageString)); JsonObject message = reader.readObject(); String messageType = message.getString("type"); if (messageType.equals("offer")) { offer = new RTCSessionDescription( RTCSdpType.valueOf(messageType.replace("_", "").toUpperCase()), message.getString("sdp")); } else if (messageType.equals("candidate")) { RTCIceCandidate candidate = new RTCIceCandidate( message.getString("id"), message.getInt("label"), message.getString("candidate")); iceCandidates.add(candidate); } } } List<RTCIceServer> iceServers = toJavaIceServers(room.getString("pc_config")); return new AppRTCSignalingParameters(iceServers, initiator, clientId, wssUrl, wssPostUrl, iceServerUrl, offer, iceCandidates); } String toJsonCommand(AppRTCCommand command) { JsonObjectBuilder builder = Json.createObjectBuilder(); if (command instanceof AppRTCRegisterCommand) { AppRTCRegisterCommand registerCommand = (AppRTCRegisterCommand) command; builder.add("cmd", registerCommand.getCommand()); builder.add("roomid", registerCommand.getRoomId()); builder.add("clientid", registerCommand.getClientId()); } else if (command instanceof AppRTCSendCommand) { AppRTCSendCommand sendCommand = (AppRTCSendCommand) command; builder.add("cmd", sendCommand.getCommand()); builder.add("msg", sendCommand.getMessage()); } return build(builder); } String toJsonMessage(AppRTCMessage message) { JsonObjectBuilder builder = Json.createObjectBuilder(); switch (message.getType()) { case CANDIDATE: RTCIceCandidate candidate = (RTCIceCandidate) message.getObject(); builder.add("type", "candidate"); builder.add("label", candidate.sdpMLineIndex); builder.add("id", candidate.sdpMid); builder.add("candidate", candidate.sdp); break; case REMOVE_CANDIDATES: RTCIceCandidate[] candidates = (RTCIceCandidate[]) message.getObject(); JsonBuilderFactory factory = Json.createBuilderFactory(Map.of()); JsonArrayBuilder jsonArray = factory.createArrayBuilder(); for (RTCIceCandidate c : candidates) { jsonArray.add(toJsonCandidate(c)); } builder.add("type", "remove-candidates"); builder.add("candidates", jsonArray); break; case ANSWER: RTCSessionDescription answer = (RTCSessionDescription) message.getObject(); builder.add("type", "answer"); builder.add("sdp", answer.sdp); break; case OFFER: RTCSessionDescription offer = (RTCSessionDescription) message.getObject(); builder.add("type", "offer"); builder.add("sdp", offer.sdp); break; case BYE: builder.add("type", "bye"); break; default: break; } return build(builder); } AppRTCMessage toJavaMessage(String json) { JsonReader reader = Json.createReader(new StringReader(json)); JsonObject jsonObject = reader.readObject(); String msgText = jsonObject.getString("msg"); String errorText = jsonObject.getString("error"); if (msgText.length() > 0) { reader = Json.createReader(new StringReader(msgText)); jsonObject = reader.readObject(); String type = jsonObject.getString("type"); switch (type) { case "candidate": return new AppRTCMessage(Type.CANDIDATE, toJavaCandidate(jsonObject)); case "remove-candidates": return new AppRTCMessage(Type.REMOVE_CANDIDATES, toJavaCandidates(jsonObject)); case "answer": return new AppRTCMessage(Type.ANSWER, toJavaSessionDescription(jsonObject)); case "offer": return new AppRTCMessage(Type.OFFER, toJavaSessionDescription( jsonObject)); case "bye": return new AppRTCMessage(Type.BYE); default: return new AppRTCMessage(Type.ERROR, "Unexpected message: " + json); } } else { if (nonNull(errorText) && errorText.length() > 0) { return new AppRTCMessage(Type.ERROR, errorText); } else { return new AppRTCMessage(Type.ERROR, "Unexpected message: " + json); } } } List<RTCIceServer> toJavaIceServers(String json) { JsonReader reader = Json.createReader(new StringReader(json)); JsonObject jsonObject = reader.readObject(); JsonArray servers = jsonObject.getJsonArray("iceServers"); List<RTCIceServer> result = new ArrayList<>(); if (isNull(servers)) { return result; } for (int i = 0; i < servers.size(); ++i) { JsonObject server = servers.getJsonObject(i); JsonArray urls = server.getJsonArray("urls"); String credential = server.containsKey("credential") ? server.getString("credential") : ""; String username = server.containsKey("username") ? server.getString("username") : ""; RTCIceServer iceServer = new RTCIceServer(); iceServer.username = username; iceServer.password = <PASSWORD>; for (int j = 0; j < urls.size(); j++) { iceServer.urls.add(urls.getString(j)); } result.add(iceServer); } return result; } String toJavaPostResponse(String response) { JsonReader reader = Json.createReader(new StringReader(response)); JsonObject roomJson = reader.readObject(); return roomJson.getString("result"); } private JsonObject toJsonCandidate(final RTCIceCandidate candidate) { JsonObjectBuilder builder = Json.createObjectBuilder() .add("label", candidate.sdpMLineIndex) .add("id", candidate.sdpMid) .add("candidate", candidate.sdp); return builder.build(); } private RTCIceCandidate toJavaCandidate(JsonObject json) { return new RTCIceCandidate(json.getString("id"), json.getInt("label"), json.getString("candidate")); } private RTCIceCandidate[] toJavaCandidates(JsonObject json) { JsonArray candidateArray = json.getJsonArray("candidates"); RTCIceCandidate[] candidates = new RTCIceCandidate[candidateArray.size()]; for (int i = 0; i < candidateArray.size(); ++i) { candidates[i] = toJavaCandidate(candidateArray.getJsonObject(i)); } return candidates; } private RTCSessionDescription toJavaSessionDescription(JsonObject json) { String type = json.getString("type"); return new RTCSessionDescription( RTCSdpType.valueOf(type.replace("_", "").toUpperCase()), json.getString("sdp")); } private static String build(JsonObjectBuilder builder) { JsonObject json = builder.build(); if (isNull(json) || json.isEmpty()) { return null; } StringWriter stringWriter = new StringWriter(); JsonWriter writer = Json.createWriter(stringWriter); writer.writeObject(json); writer.close(); return stringWriter.toString(); } }
14ms/Minecraft-Disclosed-Source-Modifications
Skizzle/us/myles/viaversion/protocols/protocol1_13to1_12_2/blockconnections/ChorusPlantConnectionHandler.java
/* * Decompiled with CFR 0.150. */ package us.myles.ViaVersion.protocols.protocol1_13to1_12_2.blockconnections; import java.util.ArrayList; import java.util.List; import us.myles.ViaVersion.api.data.UserConnection; import us.myles.ViaVersion.api.minecraft.BlockFace; import us.myles.ViaVersion.api.minecraft.Position; import us.myles.ViaVersion.protocols.protocol1_13to1_12_2.blockconnections.AbstractFenceConnectionHandler; import us.myles.ViaVersion.protocols.protocol1_13to1_12_2.blockconnections.ConnectionData; import us.myles.ViaVersion.protocols.protocol1_13to1_12_2.blockconnections.WrappedBlockData; public class ChorusPlantConnectionHandler extends AbstractFenceConnectionHandler { private final int endstone = ConnectionData.getId("minecraft:end_stone"); static List<ConnectionData.ConnectorInitAction> init() { ArrayList<ConnectionData.ConnectorInitAction> actions = new ArrayList<ConnectionData.ConnectorInitAction>(2); ChorusPlantConnectionHandler handler = new ChorusPlantConnectionHandler(); actions.add(handler.getInitAction("minecraft:chorus_plant")); actions.add(handler.getExtraAction()); return actions; } public ChorusPlantConnectionHandler() { super(null); } public ConnectionData.ConnectorInitAction getExtraAction() { return blockData -> { if (blockData.getMinecraftKey().equals("minecraft:chorus_flower")) { this.getBlockStates().add(blockData.getSavedBlockStateId()); } }; } @Override protected byte getStates(WrappedBlockData blockData) { byte states = super.getStates(blockData); if (blockData.getValue("up").equals("true")) { states = (byte)(states | 0x10); } if (blockData.getValue("down").equals("true")) { states = (byte)(states | 0x20); } return states; } @Override protected byte getStates(UserConnection user, Position position, int blockState) { byte states = super.getStates(user, position, blockState); if (this.connects(BlockFace.TOP, this.getBlockData(user, position.getRelative(BlockFace.TOP)), false)) { states = (byte)(states | 0x10); } if (this.connects(BlockFace.BOTTOM, this.getBlockData(user, position.getRelative(BlockFace.BOTTOM)), false)) { states = (byte)(states | 0x20); } return states; } @Override protected boolean connects(BlockFace side, int blockState, boolean pre1_12) { return this.getBlockStates().contains(blockState) || side == BlockFace.BOTTOM && blockState == this.endstone; } }
jsimck/uni
ano1/5-mog/gaussian.cpp
#include "gaussian.h" #include <cmath> #include <utils.h> #include <cassert> #include <opencv2/opencv.hpp> double Gaussian::calcProbability(double X, Gaussian &g) { double e = std::exp(-((SQR(X - g.u) / (2.0 * SQR(g.sd))))); double p = (1.0 / (g.sd * std::sqrt(2.0 * M_PI))) * e; return p; } double Gaussian::sumProbability(double X, std::vector<Gaussian> &gaussians) { double sum = 0; for (auto g : gaussians) { sum += g.p * calcProbability(X, g); } return sum; } double Gaussian::conditionalProbability(double X, Gaussian &g, double sumP) { return (g.p * calcProbability(X, g)) / sumP; } void Gaussian::update(double X, double sumP, double alpha, double minSD) { // Probabilities double alphaP = alpha * conditionalProbability(X, *this, sumP); double newP = (1.0 - alpha) * this->p + alphaP; double ro = alphaP / newP; // SD and mean double newU = (1 - ro) * this->u + ro * X; double newSD = std::sqrt((1 - ro) * SQR(this->sd) + ro * SQR(X - newU)); // Update new calculated values this->u = newU; this->sd = (newSD < minSD) ? minSD : newSD; this->p = newP; } int Gaussian::max(double X, std::vector<Gaussian> &gaussians) { double maxP = 0; int maxIndex = -1; for (int i = 0; i < gaussians.size(); i++) { double P = conditionalProbability(X, gaussians[i]); if (P > maxP) { maxP = P; maxIndex = i; } } return maxIndex; } void Gaussian::visualize(cv::Mat &dst, std::vector<std::vector<std::vector<Gaussian>>> &gaussians, cv::Point &center, int x) { // Init variables dst = cv::Mat::zeros(256, 256, CV_8UC3); std::vector<std::vector<cv::Point_<double>>> graphsPoints; double maxY = 0; // Gaussian colors cv::Vec3b colors[5] = { cv::Vec3b(244, 67, 54), cv::Vec3b(103, 58, 183), cv::Vec3b(33, 150, 243), cv::Vec3b(76, 175, 80), cv::Vec3b(63, 81, 181), }; // Find maxY and extract gaussian points for (int x = 0; x < dst.cols - 1; x++) { std::vector<cv::Point_<double>> graphsPoint; // Extract points for each gaussian for (int i = 0; i < gaussians[center.y][center.x].size(); i++) { double y = Gaussian::calcProbability(x, gaussians[center.y][center.x][i]); graphsPoint.push_back(cv::Point_<double>(x, y)); // Find maxY if (y > maxY) { maxY = y; } } graphsPoints.push_back(graphsPoint); } double offset = 240 / maxY; // Draw gaussian points with given offset for (int i = 1; i < graphsPoints.size(); i++) { for (int j = 0; j < graphsPoints[i].size(); j++) { cv::Point p1( static_cast<int>(graphsPoints[i - 1][j].x), static_cast<int>(255 - offset * graphsPoints[i - 1][j].y) ); cv::Point p2( static_cast<int>(graphsPoints[i][j].x), static_cast<int>(255 - offset * graphsPoints[i][j].y) ); // Draw line between 2 points cv::line(dst, p1, p2, colors[j % 5], 1); } } // Draw line where the pixel value is located now cv::line(dst, cv::Point(x, 0), cv::Point(x, dst.rows), cv::Vec3b(0, 255, 0), 2); cv::putText(dst, std::to_string(x), cv::Point(15, 30), CV_FONT_HERSHEY_SIMPLEX, 0.5, cv::Vec3b(255, 255, 255)); } std::ostream &operator<<(std::ostream &os, const Gaussian &gaussian) { os << "sd: " << static_cast<int>(gaussian.sd) << " u: " << static_cast<int>(gaussian.u) << " p: " << gaussian.p << " <" << (gaussian.u - 3 * gaussian.sd) << ", " << (gaussian.u + 3 * gaussian.sd) << ">"; return os; }
Jiangtong-Li/ZHSIR
src/package/args/pcyc_args.py
import argparse def parse_config(): parser = argparse.ArgumentParser() parser.add_argument('--save_dir', type=str, default='pcyc_test', help='The directory to save the model and logs') parser.add_argument('--sketch_dir', type=str, help='The directory of sketches. The directory can be defined in dataset/data_san.py, but parsed ' 'value will have the greater priority if given. Whatever, test/training classes of the ' 'given dataset must be provided in dataset/utils.py.', default='') parser.add_argument('--image_dir', type=str, help='The directory of images. The directory can be defined in dataset/data_san.py, but parsed ' 'value will have the greater priority if given. Whatever, test/training classes of the ' 'given dataset must be provided in dataset/utils.py.', default='') parser.add_argument('--npy_dir', type=str, help='The npy files directory. By set it 0 to load the default folder provided in ' 'dataset/data_san.py. Whatever, test/training classes of the ' 'given dataset must be provided in dataset/utils.py.', default=None) parser.add_argument('--start_from', type=str, default=None, help='The iteration the training starts from or the exact model file name. ' 'Default: None -- Try to start from the latest checkpoint.') parser.add_argument('--paired', type=int, default=0, help='Whether paired data must be given.') parser.add_argument('--ni_path', type=str, default=None, help='A pkl file path. The object should be a dict:' ' names[\'class_name\'][\'im\'/\'st\'/\'sk\'][i] = filename_without_postfix_of_the_class_image' 'Set it to \'to use default path defined in dataset/data_san.py.') parser.add_argument('--lambda-se', default=10.0, type=float, help='Weight on the semantic model') parser.add_argument('--lambda-im', default=10.0, type=float, help='Weight on the image model') parser.add_argument('--lambda-sk', default=10.0, type=float, help='Weight on the sketch model') parser.add_argument('--lambda-gen-cyc', default=1.0, type=float, help='Weight on cycle consistency loss (gen)') parser.add_argument('--lambda-gen-adv', default=1.0, type=float, help='Weight on adversarial loss (gen)') parser.add_argument('--lambda-gen-cls', default=1.0, type=float, help='Weight on classification loss (gen)') parser.add_argument('--lambda-gen-reg', default=0.1, type=float, help='Weight on regression loss (gen)') parser.add_argument('--lambda-disc-se', default=0.25, type=float, help='Weight on semantic loss (disc)') parser.add_argument('--lambda-disc-sk', default=0.5, type=float, help='Weight on sketch loss (disc)') parser.add_argument('--lambda-disc-im', default=0.5, type=float, help='Weight on image loss (disc)') parser.add_argument('--lambda-regular', default=0.001, type=float, help='Weight on regularizer') parser.add_argument('--dim_enc', default=128, type=int, help='Output dimension of sketch and image') parser.add_argument('--print_every', type=int, default=1, help='Number of epochs to print information') parser.add_argument('--save_every', type=int, default=1, help='Number of epochs to save model') parser.add_argument('--epochs', type=int, default=20, help='Number of epochs to train') parser.add_argument('--batch_size', type=int, default=32) parser.add_argument('--lr', default=0.002, metavar='LR', help='Initial learning rate [1e-5, 5e-4] (default: 1e-4)') parser.add_argument('--dataset', type=str, default='sketchy', help='[sketchy] or [tuberlin]') return parser.parse_args()
welterde/ewok
com/planet_ink/coffee_mud/Commands/ClanResign.java
package com.planet_ink.coffee_mud.Commands; import com.planet_ink.coffee_mud.core.interfaces.*; import com.planet_ink.coffee_mud.core.*; import com.planet_ink.coffee_mud.Abilities.interfaces.*; import com.planet_ink.coffee_mud.Areas.interfaces.*; import com.planet_ink.coffee_mud.Behaviors.interfaces.*; import com.planet_ink.coffee_mud.CharClasses.interfaces.*; import com.planet_ink.coffee_mud.Commands.interfaces.*; import com.planet_ink.coffee_mud.Common.interfaces.*; import com.planet_ink.coffee_mud.Exits.interfaces.*; import com.planet_ink.coffee_mud.Items.interfaces.*; import com.planet_ink.coffee_mud.Locales.interfaces.*; import com.planet_ink.coffee_mud.MOBS.interfaces.*; import com.planet_ink.coffee_mud.Races.interfaces.*; import java.util.*; /* Copyright 2000-2010 <NAME> 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. */ @SuppressWarnings("unchecked") public class ClanResign extends StdCommand { public ClanResign(){} private String[] access={"CLANRESIGN"}; public String[] getAccessWords(){return access;} public boolean execute(MOB mob, Vector commands, int metaFlags) throws java.io.IOException { StringBuffer msg=new StringBuffer(""); if((mob.getClanID()==null) ||(mob.getClanID().equalsIgnoreCase(""))) { msg.append("You aren't even a member of a clan."); } else if(!mob.isMonster()) { Clan C=CMLib.clans().getClan(mob.getClanID()); try { String check=mob.session().prompt("Are you absolutely SURE (y/N)?","N"); if(check.equalsIgnoreCase("Y")) { if(C!=null) CMLib.clans().clanAnnounce(mob,"Member resigned from "+C.typeName()+" "+C.name()+": "+mob.Name()); if(C!=null) C.delMember(mob); else { CMLib.database().DBUpdateClanMembership(mob.Name(), "", 0); mob.setClanID(""); mob.setClanRole(0); CMLib.database().DBUpdateClanMembership(mob.Name(),"",0); } } else { return false; } } catch(java.io.IOException e) { } } mob.tell(msg.toString()); return false; } public boolean canBeOrdered(){return false;} }
ManuRodgers/react-dva-chat
node_modules/antd-mobile/es/pagination/style/index.native.js
<filename>node_modules/antd-mobile/es/pagination/style/index.native.js import variables from '../../style/themes/default.native'; export default { container: { alignItems: 'center', justifyContent: 'center' }, numberStyle: { flexDirection: 'row', justifyContent: 'center' }, totalStyle: { fontSize: 18, color: variables.color_text_base }, activeTextStyle: { fontSize: 18, color: variables.color_link }, indicatorStyle: { flexDirection: 'row' }, pointStyle: { width: 8, height: 8, borderRadius: 8, backgroundColor: variables.input_color_icon }, pointActiveStyle: { backgroundColor: '#888' }, spaceStyle: { marginHorizontal: variables.h_spacing_sm / 2, marginVertical: variables.v_spacing_sm / 2 } };
liuyukuai/commons
commons-test/src/main/java/com/itxiaoer/commons/test/mvc/MockMvcConsumers.java
package com.itxiaoer.commons.test.mvc; import com.itxiaoer.commons.core.page.ResponseCode; import lombok.extern.slf4j.Slf4j; import org.springframework.test.web.servlet.ResultActions; import org.springframework.test.web.servlet.result.MockMvcResultMatchers; import java.util.function.Consumer; /** * @author : liuyk */ @Slf4j @SuppressWarnings({"unused", "WeakerAccess"}) public final class MockMvcConsumers { private static final Consumer<ResultActions> DEFAULT_SUCCESS = (actions) -> { try { actions.andExpect(MockMvcResultMatchers.jsonPath("$.success").value("true")) .andExpect(MockMvcResultMatchers.jsonPath("$.code").value(ResponseCode.SUCCESS.getCode())); } catch (Exception e) { log.error(e.getMessage(), e); } }; private static Consumer<ResultActions> DEFAULT_FAIL = (actions) -> { try { actions.andExpect(MockMvcResultMatchers.jsonPath("$.success").value("false")) .andExpect(MockMvcResultMatchers.jsonPath("$.code").value(ResponseCode.SUCCESS.getCode())); } catch (Exception e) { log.error(e.getMessage(), e); } }; public static Consumer<ResultActions> ok() { return DEFAULT_SUCCESS; } public static <T> Consumer<ResultActions> ok(T t) { return DEFAULT_SUCCESS.andThen((actions) -> { try { actions.andExpect(MockMvcResultMatchers.jsonPath("$.data").value(t)); } catch (Exception e) { log.error(e.getMessage(), e); } }); } public static Consumer<ResultActions> fail() { return DEFAULT_FAIL; } public static Consumer<ResultActions> fail(String code) { return (actions) -> { try { actions.andExpect(MockMvcResultMatchers.jsonPath("$.success").value("false")) .andExpect(MockMvcResultMatchers.jsonPath("$.code").value(code)); } catch (Exception e) { log.error(e.getMessage(), e); } }; } }
CharlesCheung96/tiflow
dm/dm/pb/dmmaster.pb.go
<filename>dm/dm/pb/dmmaster.pb.go<gh_stars>0 // Code generated by protoc-gen-gogo. DO NOT EDIT. // source: dmmaster.proto package pb import ( context "context" fmt "fmt" proto "github.com/gogo/protobuf/proto" _ "google.golang.org/genproto/googleapis/api/annotations" grpc "google.golang.org/grpc" codes "google.golang.org/grpc/codes" status "google.golang.org/grpc/status" io "io" math "math" math_bits "math/bits" ) // Reference imports to suppress errors if they are not otherwise used. var _ = proto.Marshal var _ = fmt.Errorf var _ = math.Inf // This is a compile-time assertion to ensure that this generated file // is compatible with the proto package it is being compiled against. // A compilation error at this line likely means your copy of the // proto package needs to be updated. const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package type UnlockDDLLockOp int32 const ( UnlockDDLLockOp_InvalidLockOp UnlockDDLLockOp = 0 UnlockDDLLockOp_SkipLock UnlockDDLLockOp = 1 UnlockDDLLockOp_ExecLock UnlockDDLLockOp = 2 ) var UnlockDDLLockOp_name = map[int32]string{ 0: "InvalidLockOp", 1: "SkipLock", 2: "ExecLock", } var UnlockDDLLockOp_value = map[string]int32{ "InvalidLockOp": 0, "SkipLock": 1, "ExecLock": 2, } func (x UnlockDDLLockOp) String() string { return proto.EnumName(UnlockDDLLockOp_name, int32(x)) } func (UnlockDDLLockOp) EnumDescriptor() ([]byte, []int) { return fileDescriptor_f9bef11f2a341f03, []int{0} } type SourceOp int32 const ( SourceOp_InvalidSourceOp SourceOp = 0 SourceOp_StartSource SourceOp = 1 SourceOp_UpdateSource SourceOp = 2 SourceOp_StopSource SourceOp = 3 SourceOp_ShowSource SourceOp = 4 ) var SourceOp_name = map[int32]string{ 0: "InvalidSourceOp", 1: "StartSource", 2: "UpdateSource", 3: "StopSource", 4: "ShowSource", } var SourceOp_value = map[string]int32{ "InvalidSourceOp": 0, "StartSource": 1, "UpdateSource": 2, "StopSource": 3, "ShowSource": 4, } func (x SourceOp) String() string { return proto.EnumName(SourceOp_name, int32(x)) } func (SourceOp) EnumDescriptor() ([]byte, []int) { return fileDescriptor_f9bef11f2a341f03, []int{1} } type LeaderOp int32 const ( LeaderOp_InvalidLeaderOp LeaderOp = 0 LeaderOp_EvictLeaderOp LeaderOp = 1 LeaderOp_CancelEvictLeaderOp LeaderOp = 2 ) var LeaderOp_name = map[int32]string{ 0: "InvalidLeaderOp", 1: "EvictLeaderOp", 2: "CancelEvictLeaderOp", } var LeaderOp_value = map[string]int32{ "InvalidLeaderOp": 0, "EvictLeaderOp": 1, "CancelEvictLeaderOp": 2, } func (x LeaderOp) String() string { return proto.EnumName(LeaderOp_name, int32(x)) } func (LeaderOp) EnumDescriptor() ([]byte, []int) { return fileDescriptor_f9bef11f2a341f03, []int{2} } type CfgType int32 const ( CfgType_InvalidType CfgType = 0 CfgType_TaskType CfgType = 1 CfgType_MasterType CfgType = 2 CfgType_WorkerType CfgType = 3 CfgType_SourceType CfgType = 4 CfgType_TaskTemplateType CfgType = 5 ) var CfgType_name = map[int32]string{ 0: "InvalidType", 1: "TaskType", 2: "MasterType", 3: "WorkerType", 4: "SourceType", 5: "TaskTemplateType", } var CfgType_value = map[string]int32{ "InvalidType": 0, "TaskType": 1, "MasterType": 2, "WorkerType": 3, "SourceType": 4, "TaskTemplateType": 5, } func (x CfgType) String() string { return proto.EnumName(CfgType_name, int32(x)) } func (CfgType) EnumDescriptor() ([]byte, []int) { return fileDescriptor_f9bef11f2a341f03, []int{3} } type RelayOpV2 int32 const ( RelayOpV2_InvalidRelayOpV2 RelayOpV2 = 0 RelayOpV2_StartRelayV2 RelayOpV2 = 1 RelayOpV2_StopRelayV2 RelayOpV2 = 2 ) var RelayOpV2_name = map[int32]string{ 0: "InvalidRelayOpV2", 1: "StartRelayV2", 2: "StopRelayV2", } var RelayOpV2_value = map[string]int32{ "InvalidRelayOpV2": 0, "StartRelayV2": 1, "StopRelayV2": 2, } func (x RelayOpV2) String() string { return proto.EnumName(RelayOpV2_name, int32(x)) } func (RelayOpV2) EnumDescriptor() ([]byte, []int) { return fileDescriptor_f9bef11f2a341f03, []int{4} } type StartTaskRequest struct { Task string `protobuf:"bytes,1,opt,name=task,proto3" json:"task,omitempty"` Sources []string `protobuf:"bytes,2,rep,name=sources,proto3" json:"sources,omitempty"` RemoveMeta bool `protobuf:"varint,3,opt,name=removeMeta,proto3" json:"removeMeta,omitempty"` StartTime string `protobuf:"bytes,4,opt,name=startTime,proto3" json:"startTime,omitempty"` } func (m *StartTaskRequest) Reset() { *m = StartTaskRequest{} } func (m *StartTaskRequest) String() string { return proto.CompactTextString(m) } func (*StartTaskRequest) ProtoMessage() {} func (*StartTaskRequest) Descriptor() ([]byte, []int) { return fileDescriptor_f9bef11f2a341f03, []int{0} } func (m *StartTaskRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } func (m *StartTaskRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_StartTaskRequest.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) if err != nil { return nil, err } return b[:n], nil } } func (m *StartTaskRequest) XXX_Merge(src proto.Message) { xxx_messageInfo_StartTaskRequest.Merge(m, src) } func (m *StartTaskRequest) XXX_Size() int { return m.Size() } func (m *StartTaskRequest) XXX_DiscardUnknown() { xxx_messageInfo_StartTaskRequest.DiscardUnknown(m) } var xxx_messageInfo_StartTaskRequest proto.InternalMessageInfo func (m *StartTaskRequest) GetTask() string { if m != nil { return m.Task } return "" } func (m *StartTaskRequest) GetSources() []string { if m != nil { return m.Sources } return nil } func (m *StartTaskRequest) GetRemoveMeta() bool { if m != nil { return m.RemoveMeta } return false } func (m *StartTaskRequest) GetStartTime() string { if m != nil { return m.StartTime } return "" } type StartTaskResponse struct { Result bool `protobuf:"varint,1,opt,name=result,proto3" json:"result,omitempty"` Msg string `protobuf:"bytes,2,opt,name=msg,proto3" json:"msg,omitempty"` Sources []*CommonWorkerResponse `protobuf:"bytes,3,rep,name=sources,proto3" json:"sources,omitempty"` CheckResult string `protobuf:"bytes,4,opt,name=checkResult,proto3" json:"checkResult,omitempty"` } func (m *StartTaskResponse) Reset() { *m = StartTaskResponse{} } func (m *StartTaskResponse) String() string { return proto.CompactTextString(m) } func (*StartTaskResponse) ProtoMessage() {} func (*StartTaskResponse) Descriptor() ([]byte, []int) { return fileDescriptor_f9bef11f2a341f03, []int{1} } func (m *StartTaskResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } func (m *StartTaskResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_StartTaskResponse.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) if err != nil { return nil, err } return b[:n], nil } } func (m *StartTaskResponse) XXX_Merge(src proto.Message) { xxx_messageInfo_StartTaskResponse.Merge(m, src) } func (m *StartTaskResponse) XXX_Size() int { return m.Size() } func (m *StartTaskResponse) XXX_DiscardUnknown() { xxx_messageInfo_StartTaskResponse.DiscardUnknown(m) } var xxx_messageInfo_StartTaskResponse proto.InternalMessageInfo func (m *StartTaskResponse) GetResult() bool { if m != nil { return m.Result } return false } func (m *StartTaskResponse) GetMsg() string { if m != nil { return m.Msg } return "" } func (m *StartTaskResponse) GetSources() []*CommonWorkerResponse { if m != nil { return m.Sources } return nil } func (m *StartTaskResponse) GetCheckResult() string { if m != nil { return m.CheckResult } return "" } type OperateTaskRequest struct { Op TaskOp `protobuf:"varint,1,opt,name=op,proto3,enum=pb.TaskOp" json:"op,omitempty"` Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"` Sources []string `protobuf:"bytes,3,rep,name=sources,proto3" json:"sources,omitempty"` } func (m *OperateTaskRequest) Reset() { *m = OperateTaskRequest{} } func (m *OperateTaskRequest) String() string { return proto.CompactTextString(m) } func (*OperateTaskRequest) ProtoMessage() {} func (*OperateTaskRequest) Descriptor() ([]byte, []int) { return fileDescriptor_f9bef11f2a341f03, []int{2} } func (m *OperateTaskRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } func (m *OperateTaskRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_OperateTaskRequest.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) if err != nil { return nil, err } return b[:n], nil } } func (m *OperateTaskRequest) XXX_Merge(src proto.Message) { xxx_messageInfo_OperateTaskRequest.Merge(m, src) } func (m *OperateTaskRequest) XXX_Size() int { return m.Size() } func (m *OperateTaskRequest) XXX_DiscardUnknown() { xxx_messageInfo_OperateTaskRequest.DiscardUnknown(m) } var xxx_messageInfo_OperateTaskRequest proto.InternalMessageInfo func (m *OperateTaskRequest) GetOp() TaskOp { if m != nil { return m.Op } return TaskOp_InvalidOp } func (m *OperateTaskRequest) GetName() string { if m != nil { return m.Name } return "" } func (m *OperateTaskRequest) GetSources() []string { if m != nil { return m.Sources } return nil } type OperateTaskResponse struct { Op TaskOp `protobuf:"varint,1,opt,name=op,proto3,enum=pb.TaskOp" json:"op,omitempty"` Result bool `protobuf:"varint,2,opt,name=result,proto3" json:"result,omitempty"` Msg string `protobuf:"bytes,3,opt,name=msg,proto3" json:"msg,omitempty"` Sources []*CommonWorkerResponse `protobuf:"bytes,4,rep,name=sources,proto3" json:"sources,omitempty"` } func (m *OperateTaskResponse) Reset() { *m = OperateTaskResponse{} } func (m *OperateTaskResponse) String() string { return proto.CompactTextString(m) } func (*OperateTaskResponse) ProtoMessage() {} func (*OperateTaskResponse) Descriptor() ([]byte, []int) { return fileDescriptor_f9bef11f2a341f03, []int{3} } func (m *OperateTaskResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } func (m *OperateTaskResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_OperateTaskResponse.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) if err != nil { return nil, err } return b[:n], nil } } func (m *OperateTaskResponse) XXX_Merge(src proto.Message) { xxx_messageInfo_OperateTaskResponse.Merge(m, src) } func (m *OperateTaskResponse) XXX_Size() int { return m.Size() } func (m *OperateTaskResponse) XXX_DiscardUnknown() { xxx_messageInfo_OperateTaskResponse.DiscardUnknown(m) } var xxx_messageInfo_OperateTaskResponse proto.InternalMessageInfo func (m *OperateTaskResponse) GetOp() TaskOp { if m != nil { return m.Op } return TaskOp_InvalidOp } func (m *OperateTaskResponse) GetResult() bool { if m != nil { return m.Result } return false } func (m *OperateTaskResponse) GetMsg() string { if m != nil { return m.Msg } return "" } func (m *OperateTaskResponse) GetSources() []*CommonWorkerResponse { if m != nil { return m.Sources } return nil } // UpdateTaskRequest used to update task after it has beed started // task: task's configuration, yaml format // now, only support to update config for routes, filters, column-mappings, block-allow-list // support update partial config for syncer, loader, etc later // sources need to do update, empty for all sources in processing the task type UpdateTaskRequest struct { Task string `protobuf:"bytes,1,opt,name=task,proto3" json:"task,omitempty"` Sources []string `protobuf:"bytes,2,rep,name=sources,proto3" json:"sources,omitempty"` } func (m *UpdateTaskRequest) Reset() { *m = UpdateTaskRequest{} } func (m *UpdateTaskRequest) String() string { return proto.CompactTextString(m) } func (*UpdateTaskRequest) ProtoMessage() {} func (*UpdateTaskRequest) Descriptor() ([]byte, []int) { return fileDescriptor_f9bef11f2a341f03, []int{4} } func (m *UpdateTaskRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } func (m *UpdateTaskRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_UpdateTaskRequest.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) if err != nil { return nil, err } return b[:n], nil } } func (m *UpdateTaskRequest) XXX_Merge(src proto.Message) { xxx_messageInfo_UpdateTaskRequest.Merge(m, src) } func (m *UpdateTaskRequest) XXX_Size() int { return m.Size() } func (m *UpdateTaskRequest) XXX_DiscardUnknown() { xxx_messageInfo_UpdateTaskRequest.DiscardUnknown(m) } var xxx_messageInfo_UpdateTaskRequest proto.InternalMessageInfo func (m *UpdateTaskRequest) GetTask() string { if m != nil { return m.Task } return "" } func (m *UpdateTaskRequest) GetSources() []string { if m != nil { return m.Sources } return nil } type UpdateTaskResponse struct { Result bool `protobuf:"varint,1,opt,name=result,proto3" json:"result,omitempty"` Msg string `protobuf:"bytes,2,opt,name=msg,proto3" json:"msg,omitempty"` Sources []*CommonWorkerResponse `protobuf:"bytes,3,rep,name=sources,proto3" json:"sources,omitempty"` CheckResult string `protobuf:"bytes,4,opt,name=checkResult,proto3" json:"checkResult,omitempty"` } func (m *UpdateTaskResponse) Reset() { *m = UpdateTaskResponse{} } func (m *UpdateTaskResponse) String() string { return proto.CompactTextString(m) } func (*UpdateTaskResponse) ProtoMessage() {} func (*UpdateTaskResponse) Descriptor() ([]byte, []int) { return fileDescriptor_f9bef11f2a341f03, []int{5} } func (m *UpdateTaskResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } func (m *UpdateTaskResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_UpdateTaskResponse.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) if err != nil { return nil, err } return b[:n], nil } } func (m *UpdateTaskResponse) XXX_Merge(src proto.Message) { xxx_messageInfo_UpdateTaskResponse.Merge(m, src) } func (m *UpdateTaskResponse) XXX_Size() int { return m.Size() } func (m *UpdateTaskResponse) XXX_DiscardUnknown() { xxx_messageInfo_UpdateTaskResponse.DiscardUnknown(m) } var xxx_messageInfo_UpdateTaskResponse proto.InternalMessageInfo func (m *UpdateTaskResponse) GetResult() bool { if m != nil { return m.Result } return false } func (m *UpdateTaskResponse) GetMsg() string { if m != nil { return m.Msg } return "" } func (m *UpdateTaskResponse) GetSources() []*CommonWorkerResponse { if m != nil { return m.Sources } return nil } func (m *UpdateTaskResponse) GetCheckResult() string { if m != nil { return m.CheckResult } return "" } type QueryStatusListRequest struct { Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` Sources []string `protobuf:"bytes,2,rep,name=sources,proto3" json:"sources,omitempty"` } func (m *QueryStatusListRequest) Reset() { *m = QueryStatusListRequest{} } func (m *QueryStatusListRequest) String() string { return proto.CompactTextString(m) } func (*QueryStatusListRequest) ProtoMessage() {} func (*QueryStatusListRequest) Descriptor() ([]byte, []int) { return fileDescriptor_f9bef11f2a341f03, []int{6} } func (m *QueryStatusListRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } func (m *QueryStatusListRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_QueryStatusListRequest.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) if err != nil { return nil, err } return b[:n], nil } } func (m *QueryStatusListRequest) XXX_Merge(src proto.Message) { xxx_messageInfo_QueryStatusListRequest.Merge(m, src) } func (m *QueryStatusListRequest) XXX_Size() int { return m.Size() } func (m *QueryStatusListRequest) XXX_DiscardUnknown() { xxx_messageInfo_QueryStatusListRequest.DiscardUnknown(m) } var xxx_messageInfo_QueryStatusListRequest proto.InternalMessageInfo func (m *QueryStatusListRequest) GetName() string { if m != nil { return m.Name } return "" } func (m *QueryStatusListRequest) GetSources() []string { if m != nil { return m.Sources } return nil } type QueryStatusListResponse struct { Result bool `protobuf:"varint,1,opt,name=result,proto3" json:"result,omitempty"` Msg string `protobuf:"bytes,2,opt,name=msg,proto3" json:"msg,omitempty"` Sources []*QueryStatusResponse `protobuf:"bytes,3,rep,name=sources,proto3" json:"sources,omitempty"` } func (m *QueryStatusListResponse) Reset() { *m = QueryStatusListResponse{} } func (m *QueryStatusListResponse) String() string { return proto.CompactTextString(m) } func (*QueryStatusListResponse) ProtoMessage() {} func (*QueryStatusListResponse) Descriptor() ([]byte, []int) { return fileDescriptor_f9bef11f2a341f03, []int{7} } func (m *QueryStatusListResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } func (m *QueryStatusListResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_QueryStatusListResponse.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) if err != nil { return nil, err } return b[:n], nil } } func (m *QueryStatusListResponse) XXX_Merge(src proto.Message) { xxx_messageInfo_QueryStatusListResponse.Merge(m, src) } func (m *QueryStatusListResponse) XXX_Size() int { return m.Size() } func (m *QueryStatusListResponse) XXX_DiscardUnknown() { xxx_messageInfo_QueryStatusListResponse.DiscardUnknown(m) } var xxx_messageInfo_QueryStatusListResponse proto.InternalMessageInfo func (m *QueryStatusListResponse) GetResult() bool { if m != nil { return m.Result } return false } func (m *QueryStatusListResponse) GetMsg() string { if m != nil { return m.Msg } return "" } func (m *QueryStatusListResponse) GetSources() []*QueryStatusResponse { if m != nil { return m.Sources } return nil } // ShowDDLLocksRequest used to query DDL locks which are un-resolved // task: task's name, empty for all tasks // sources: source need to query, empty for all sources // any DDL lock in which the source is synced or unsynced will return // if specify task and sources both, and sources not doing the task , it will return empty DDL locks type ShowDDLLocksRequest struct { Task string `protobuf:"bytes,1,opt,name=task,proto3" json:"task,omitempty"` Sources []string `protobuf:"bytes,2,rep,name=sources,proto3" json:"sources,omitempty"` } func (m *ShowDDLLocksRequest) Reset() { *m = ShowDDLLocksRequest{} } func (m *ShowDDLLocksRequest) String() string { return proto.CompactTextString(m) } func (*ShowDDLLocksRequest) ProtoMessage() {} func (*ShowDDLLocksRequest) Descriptor() ([]byte, []int) { return fileDescriptor_f9bef11f2a341f03, []int{8} } func (m *ShowDDLLocksRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } func (m *ShowDDLLocksRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_ShowDDLLocksRequest.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) if err != nil { return nil, err } return b[:n], nil } } func (m *ShowDDLLocksRequest) XXX_Merge(src proto.Message) { xxx_messageInfo_ShowDDLLocksRequest.Merge(m, src) } func (m *ShowDDLLocksRequest) XXX_Size() int { return m.Size() } func (m *ShowDDLLocksRequest) XXX_DiscardUnknown() { xxx_messageInfo_ShowDDLLocksRequest.DiscardUnknown(m) } var xxx_messageInfo_ShowDDLLocksRequest proto.InternalMessageInfo func (m *ShowDDLLocksRequest) GetTask() string { if m != nil { return m.Task } return "" } func (m *ShowDDLLocksRequest) GetSources() []string { if m != nil { return m.Sources } return nil } // DDLLock represents a DDL lock info (I known the name confused with DDLLockInfo, any suggestion?) // it been sent from dm-master to dmctl // ID: DDL lock generated ID // task: lock's corresponding task name // mode: the shard DDL mode, `pessimistic` or `optimistic`. // owner: lock's owner, a dm-worker // DDL: DDL statement // synced: already synced dm-workers // unsynced: pending to sync dm-workers type DDLLock struct { ID string `protobuf:"bytes,1,opt,name=ID,proto3" json:"ID,omitempty"` Task string `protobuf:"bytes,2,opt,name=task,proto3" json:"task,omitempty"` Mode string `protobuf:"bytes,3,opt,name=mode,proto3" json:"mode,omitempty"` Owner string `protobuf:"bytes,4,opt,name=owner,proto3" json:"owner,omitempty"` DDLs []string `protobuf:"bytes,5,rep,name=DDLs,proto3" json:"DDLs,omitempty"` Synced []string `protobuf:"bytes,6,rep,name=synced,proto3" json:"synced,omitempty"` Unsynced []string `protobuf:"bytes,7,rep,name=unsynced,proto3" json:"unsynced,omitempty"` } func (m *DDLLock) Reset() { *m = DDLLock{} } func (m *DDLLock) String() string { return proto.CompactTextString(m) } func (*DDLLock) ProtoMessage() {} func (*DDLLock) Descriptor() ([]byte, []int) { return fileDescriptor_f9bef11f2a341f03, []int{9} } func (m *DDLLock) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } func (m *DDLLock) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_DDLLock.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) if err != nil { return nil, err } return b[:n], nil } } func (m *DDLLock) XXX_Merge(src proto.Message) { xxx_messageInfo_DDLLock.Merge(m, src) } func (m *DDLLock) XXX_Size() int { return m.Size() } func (m *DDLLock) XXX_DiscardUnknown() { xxx_messageInfo_DDLLock.DiscardUnknown(m) } var xxx_messageInfo_DDLLock proto.InternalMessageInfo func (m *DDLLock) GetID() string { if m != nil { return m.ID } return "" } func (m *DDLLock) GetTask() string { if m != nil { return m.Task } return "" } func (m *DDLLock) GetMode() string { if m != nil { return m.Mode } return "" } func (m *DDLLock) GetOwner() string { if m != nil { return m.Owner } return "" } func (m *DDLLock) GetDDLs() []string { if m != nil { return m.DDLs } return nil } func (m *DDLLock) GetSynced() []string { if m != nil { return m.Synced } return nil } func (m *DDLLock) GetUnsynced() []string { if m != nil { return m.Unsynced } return nil } type ShowDDLLocksResponse struct { Result bool `protobuf:"varint,1,opt,name=result,proto3" json:"result,omitempty"` Msg string `protobuf:"bytes,2,opt,name=msg,proto3" json:"msg,omitempty"` Locks []*DDLLock `protobuf:"bytes,3,rep,name=locks,proto3" json:"locks,omitempty"` } func (m *ShowDDLLocksResponse) Reset() { *m = ShowDDLLocksResponse{} } func (m *ShowDDLLocksResponse) String() string { return proto.CompactTextString(m) } func (*ShowDDLLocksResponse) ProtoMessage() {} func (*ShowDDLLocksResponse) Descriptor() ([]byte, []int) { return fileDescriptor_f9bef11f2a341f03, []int{10} } func (m *ShowDDLLocksResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } func (m *ShowDDLLocksResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_ShowDDLLocksResponse.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) if err != nil { return nil, err } return b[:n], nil } } func (m *ShowDDLLocksResponse) XXX_Merge(src proto.Message) { xxx_messageInfo_ShowDDLLocksResponse.Merge(m, src) } func (m *ShowDDLLocksResponse) XXX_Size() int { return m.Size() } func (m *ShowDDLLocksResponse) XXX_DiscardUnknown() { xxx_messageInfo_ShowDDLLocksResponse.DiscardUnknown(m) } var xxx_messageInfo_ShowDDLLocksResponse proto.InternalMessageInfo func (m *ShowDDLLocksResponse) GetResult() bool { if m != nil { return m.Result } return false } func (m *ShowDDLLocksResponse) GetMsg() string { if m != nil { return m.Msg } return "" } func (m *ShowDDLLocksResponse) GetLocks() []*DDLLock { if m != nil { return m.Locks } return nil } // UnlockDDLLockRequest used to unlock (resolve) DDL lock manually // ID: DDL lock ID // replaceOwner: dm-worker used to replace the original DDL lock's owner // forceRemove: force to remove the DDL lock even fail to execute the DDL for the owner. type UnlockDDLLockRequest struct { ID string `protobuf:"bytes,1,opt,name=ID,proto3" json:"ID,omitempty"` ReplaceOwner string `protobuf:"bytes,2,opt,name=replaceOwner,proto3" json:"replaceOwner,omitempty"` ForceRemove bool `protobuf:"varint,3,opt,name=forceRemove,proto3" json:"forceRemove,omitempty"` Op UnlockDDLLockOp `protobuf:"varint,4,opt,name=op,proto3,enum=pb.UnlockDDLLockOp" json:"op,omitempty"` Sources []string `protobuf:"bytes,5,rep,name=sources,proto3" json:"sources,omitempty"` Database string `protobuf:"bytes,6,opt,name=database,proto3" json:"database,omitempty"` Table string `protobuf:"bytes,7,opt,name=table,proto3" json:"table,omitempty"` } func (m *UnlockDDLLockRequest) Reset() { *m = UnlockDDLLockRequest{} } func (m *UnlockDDLLockRequest) String() string { return proto.CompactTextString(m) } func (*UnlockDDLLockRequest) ProtoMessage() {} func (*UnlockDDLLockRequest) Descriptor() ([]byte, []int) { return fileDescriptor_f9bef11f2a341f03, []int{11} } func (m *UnlockDDLLockRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } func (m *UnlockDDLLockRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_UnlockDDLLockRequest.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) if err != nil { return nil, err } return b[:n], nil } } func (m *UnlockDDLLockRequest) XXX_Merge(src proto.Message) { xxx_messageInfo_UnlockDDLLockRequest.Merge(m, src) } func (m *UnlockDDLLockRequest) XXX_Size() int { return m.Size() } func (m *UnlockDDLLockRequest) XXX_DiscardUnknown() { xxx_messageInfo_UnlockDDLLockRequest.DiscardUnknown(m) } var xxx_messageInfo_UnlockDDLLockRequest proto.InternalMessageInfo func (m *UnlockDDLLockRequest) GetID() string { if m != nil { return m.ID } return "" } func (m *UnlockDDLLockRequest) GetReplaceOwner() string { if m != nil { return m.ReplaceOwner } return "" } func (m *UnlockDDLLockRequest) GetForceRemove() bool { if m != nil { return m.ForceRemove } return false } func (m *UnlockDDLLockRequest) GetOp() UnlockDDLLockOp { if m != nil { return m.Op } return UnlockDDLLockOp_InvalidLockOp } func (m *UnlockDDLLockRequest) GetSources() []string { if m != nil { return m.Sources } return nil } func (m *UnlockDDLLockRequest) GetDatabase() string { if m != nil { return m.Database } return "" } func (m *UnlockDDLLockRequest) GetTable() string { if m != nil { return m.Table } return "" } type UnlockDDLLockResponse struct { Result bool `protobuf:"varint,1,opt,name=result,proto3" json:"result,omitempty"` Msg string `protobuf:"bytes,2,opt,name=msg,proto3" json:"msg,omitempty"` } func (m *UnlockDDLLockResponse) Reset() { *m = UnlockDDLLockResponse{} } func (m *UnlockDDLLockResponse) String() string { return proto.CompactTextString(m) } func (*UnlockDDLLockResponse) ProtoMessage() {} func (*UnlockDDLLockResponse) Descriptor() ([]byte, []int) { return fileDescriptor_f9bef11f2a341f03, []int{12} } func (m *UnlockDDLLockResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } func (m *UnlockDDLLockResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_UnlockDDLLockResponse.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) if err != nil { return nil, err } return b[:n], nil } } func (m *UnlockDDLLockResponse) XXX_Merge(src proto.Message) { xxx_messageInfo_UnlockDDLLockResponse.Merge(m, src) } func (m *UnlockDDLLockResponse) XXX_Size() int { return m.Size() } func (m *UnlockDDLLockResponse) XXX_DiscardUnknown() { xxx_messageInfo_UnlockDDLLockResponse.DiscardUnknown(m) } var xxx_messageInfo_UnlockDDLLockResponse proto.InternalMessageInfo func (m *UnlockDDLLockResponse) GetResult() bool { if m != nil { return m.Result } return false } func (m *UnlockDDLLockResponse) GetMsg() string { if m != nil { return m.Msg } return "" } // OperateWorkerRelayRequest represents a request for some dm-workers to operate relay unit type OperateWorkerRelayRequest struct { Op RelayOp `protobuf:"varint,1,opt,name=op,proto3,enum=pb.RelayOp" json:"op,omitempty"` Sources []string `protobuf:"bytes,2,rep,name=sources,proto3" json:"sources,omitempty"` } func (m *OperateWorkerRelayRequest) Reset() { *m = OperateWorkerRelayRequest{} } func (m *OperateWorkerRelayRequest) String() string { return proto.CompactTextString(m) } func (*OperateWorkerRelayRequest) ProtoMessage() {} func (*OperateWorkerRelayRequest) Descriptor() ([]byte, []int) { return fileDescriptor_f9bef11f2a341f03, []int{13} } func (m *OperateWorkerRelayRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } func (m *OperateWorkerRelayRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_OperateWorkerRelayRequest.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) if err != nil { return nil, err } return b[:n], nil } } func (m *OperateWorkerRelayRequest) XXX_Merge(src proto.Message) { xxx_messageInfo_OperateWorkerRelayRequest.Merge(m, src) } func (m *OperateWorkerRelayRequest) XXX_Size() int { return m.Size() } func (m *OperateWorkerRelayRequest) XXX_DiscardUnknown() { xxx_messageInfo_OperateWorkerRelayRequest.DiscardUnknown(m) } var xxx_messageInfo_OperateWorkerRelayRequest proto.InternalMessageInfo func (m *OperateWorkerRelayRequest) GetOp() RelayOp { if m != nil { return m.Op } return RelayOp_InvalidRelayOp } func (m *OperateWorkerRelayRequest) GetSources() []string { if m != nil { return m.Sources } return nil } type OperateWorkerRelayResponse struct { Op RelayOp `protobuf:"varint,1,opt,name=op,proto3,enum=pb.RelayOp" json:"op,omitempty"` Result bool `protobuf:"varint,2,opt,name=result,proto3" json:"result,omitempty"` Msg string `protobuf:"bytes,3,opt,name=msg,proto3" json:"msg,omitempty"` Sources []*CommonWorkerResponse `protobuf:"bytes,4,rep,name=sources,proto3" json:"sources,omitempty"` } func (m *OperateWorkerRelayResponse) Reset() { *m = OperateWorkerRelayResponse{} } func (m *OperateWorkerRelayResponse) String() string { return proto.CompactTextString(m) } func (*OperateWorkerRelayResponse) ProtoMessage() {} func (*OperateWorkerRelayResponse) Descriptor() ([]byte, []int) { return fileDescriptor_f9bef11f2a341f03, []int{14} } func (m *OperateWorkerRelayResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } func (m *OperateWorkerRelayResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_OperateWorkerRelayResponse.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) if err != nil { return nil, err } return b[:n], nil } } func (m *OperateWorkerRelayResponse) XXX_Merge(src proto.Message) { xxx_messageInfo_OperateWorkerRelayResponse.Merge(m, src) } func (m *OperateWorkerRelayResponse) XXX_Size() int { return m.Size() } func (m *OperateWorkerRelayResponse) XXX_DiscardUnknown() { xxx_messageInfo_OperateWorkerRelayResponse.DiscardUnknown(m) } var xxx_messageInfo_OperateWorkerRelayResponse proto.InternalMessageInfo func (m *OperateWorkerRelayResponse) GetOp() RelayOp { if m != nil { return m.Op } return RelayOp_InvalidRelayOp } func (m *OperateWorkerRelayResponse) GetResult() bool { if m != nil { return m.Result } return false } func (m *OperateWorkerRelayResponse) GetMsg() string { if m != nil { return m.Msg } return "" } func (m *OperateWorkerRelayResponse) GetSources() []*CommonWorkerResponse { if m != nil { return m.Sources } return nil } // PurgeWorkerRelayRequest represents a request to purge relay log files for some dm-workers // workers: dm-workers need to purge relay log files // inactive: whether purge inactive relay log files // time: whether purge relay log files before this time, the number of seconds elapsed since January 1, 1970 UTC // filename: whether purge relay log files before this filename // subDir: specify relay sub directory for @filename type PurgeWorkerRelayRequest struct { Sources []string `protobuf:"bytes,1,rep,name=sources,proto3" json:"sources,omitempty"` Inactive bool `protobuf:"varint,2,opt,name=inactive,proto3" json:"inactive,omitempty"` Time int64 `protobuf:"varint,3,opt,name=time,proto3" json:"time,omitempty"` Filename string `protobuf:"bytes,4,opt,name=filename,proto3" json:"filename,omitempty"` SubDir string `protobuf:"bytes,5,opt,name=subDir,proto3" json:"subDir,omitempty"` } func (m *PurgeWorkerRelayRequest) Reset() { *m = PurgeWorkerRelayRequest{} } func (m *PurgeWorkerRelayRequest) String() string { return proto.CompactTextString(m) } func (*PurgeWorkerRelayRequest) ProtoMessage() {} func (*PurgeWorkerRelayRequest) Descriptor() ([]byte, []int) { return fileDescriptor_f9bef11f2a341f03, []int{15} } func (m *PurgeWorkerRelayRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } func (m *PurgeWorkerRelayRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_PurgeWorkerRelayRequest.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) if err != nil { return nil, err } return b[:n], nil } } func (m *PurgeWorkerRelayRequest) XXX_Merge(src proto.Message) { xxx_messageInfo_PurgeWorkerRelayRequest.Merge(m, src) } func (m *PurgeWorkerRelayRequest) XXX_Size() int { return m.Size() } func (m *PurgeWorkerRelayRequest) XXX_DiscardUnknown() { xxx_messageInfo_PurgeWorkerRelayRequest.DiscardUnknown(m) } var xxx_messageInfo_PurgeWorkerRelayRequest proto.InternalMessageInfo func (m *PurgeWorkerRelayRequest) GetSources() []string { if m != nil { return m.Sources } return nil } func (m *PurgeWorkerRelayRequest) GetInactive() bool { if m != nil { return m.Inactive } return false } func (m *PurgeWorkerRelayRequest) GetTime() int64 { if m != nil { return m.Time } return 0 } func (m *PurgeWorkerRelayRequest) GetFilename() string { if m != nil { return m.Filename } return "" } func (m *PurgeWorkerRelayRequest) GetSubDir() string { if m != nil { return m.SubDir } return "" } type PurgeWorkerRelayResponse struct { Result bool `protobuf:"varint,1,opt,name=result,proto3" json:"result,omitempty"` Msg string `protobuf:"bytes,2,opt,name=msg,proto3" json:"msg,omitempty"` Sources []*CommonWorkerResponse `protobuf:"bytes,3,rep,name=sources,proto3" json:"sources,omitempty"` } func (m *PurgeWorkerRelayResponse) Reset() { *m = PurgeWorkerRelayResponse{} } func (m *PurgeWorkerRelayResponse) String() string { return proto.CompactTextString(m) } func (*PurgeWorkerRelayResponse) ProtoMessage() {} func (*PurgeWorkerRelayResponse) Descriptor() ([]byte, []int) { return fileDescriptor_f9bef11f2a341f03, []int{16} } func (m *PurgeWorkerRelayResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } func (m *PurgeWorkerRelayResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_PurgeWorkerRelayResponse.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) if err != nil { return nil, err } return b[:n], nil } } func (m *PurgeWorkerRelayResponse) XXX_Merge(src proto.Message) { xxx_messageInfo_PurgeWorkerRelayResponse.Merge(m, src) } func (m *PurgeWorkerRelayResponse) XXX_Size() int { return m.Size() } func (m *PurgeWorkerRelayResponse) XXX_DiscardUnknown() { xxx_messageInfo_PurgeWorkerRelayResponse.DiscardUnknown(m) } var xxx_messageInfo_PurgeWorkerRelayResponse proto.InternalMessageInfo func (m *PurgeWorkerRelayResponse) GetResult() bool { if m != nil { return m.Result } return false } func (m *PurgeWorkerRelayResponse) GetMsg() string { if m != nil { return m.Msg } return "" } func (m *PurgeWorkerRelayResponse) GetSources() []*CommonWorkerResponse { if m != nil { return m.Sources } return nil } type CheckTaskRequest struct { Task string `protobuf:"bytes,1,opt,name=task,proto3" json:"task,omitempty"` ErrCnt int64 `protobuf:"varint,2,opt,name=errCnt,proto3" json:"errCnt,omitempty"` WarnCnt int64 `protobuf:"varint,3,opt,name=warnCnt,proto3" json:"warnCnt,omitempty"` StartTime string `protobuf:"bytes,4,opt,name=startTime,proto3" json:"startTime,omitempty"` } func (m *CheckTaskRequest) Reset() { *m = CheckTaskRequest{} } func (m *CheckTaskRequest) String() string { return proto.CompactTextString(m) } func (*CheckTaskRequest) ProtoMessage() {} func (*CheckTaskRequest) Descriptor() ([]byte, []int) { return fileDescriptor_f9bef11f2a341f03, []int{17} } func (m *CheckTaskRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } func (m *CheckTaskRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_CheckTaskRequest.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) if err != nil { return nil, err } return b[:n], nil } } func (m *CheckTaskRequest) XXX_Merge(src proto.Message) { xxx_messageInfo_CheckTaskRequest.Merge(m, src) } func (m *CheckTaskRequest) XXX_Size() int { return m.Size() } func (m *CheckTaskRequest) XXX_DiscardUnknown() { xxx_messageInfo_CheckTaskRequest.DiscardUnknown(m) } var xxx_messageInfo_CheckTaskRequest proto.InternalMessageInfo func (m *CheckTaskRequest) GetTask() string { if m != nil { return m.Task } return "" } func (m *CheckTaskRequest) GetErrCnt() int64 { if m != nil { return m.ErrCnt } return 0 } func (m *CheckTaskRequest) GetWarnCnt() int64 { if m != nil { return m.WarnCnt } return 0 } func (m *CheckTaskRequest) GetStartTime() string { if m != nil { return m.StartTime } return "" } type CheckTaskResponse struct { Result bool `protobuf:"varint,1,opt,name=result,proto3" json:"result,omitempty"` Msg string `protobuf:"bytes,2,opt,name=msg,proto3" json:"msg,omitempty"` } func (m *CheckTaskResponse) Reset() { *m = CheckTaskResponse{} } func (m *CheckTaskResponse) String() string { return proto.CompactTextString(m) } func (*CheckTaskResponse) ProtoMessage() {} func (*CheckTaskResponse) Descriptor() ([]byte, []int) { return fileDescriptor_f9bef11f2a341f03, []int{18} } func (m *CheckTaskResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } func (m *CheckTaskResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_CheckTaskResponse.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) if err != nil { return nil, err } return b[:n], nil } } func (m *CheckTaskResponse) XXX_Merge(src proto.Message) { xxx_messageInfo_CheckTaskResponse.Merge(m, src) } func (m *CheckTaskResponse) XXX_Size() int { return m.Size() } func (m *CheckTaskResponse) XXX_DiscardUnknown() { xxx_messageInfo_CheckTaskResponse.DiscardUnknown(m) } var xxx_messageInfo_CheckTaskResponse proto.InternalMessageInfo func (m *CheckTaskResponse) GetResult() bool { if m != nil { return m.Result } return false } func (m *CheckTaskResponse) GetMsg() string { if m != nil { return m.Msg } return "" } type OperateSourceRequest struct { Op SourceOp `protobuf:"varint,1,opt,name=op,proto3,enum=pb.SourceOp" json:"op,omitempty"` Config []string `protobuf:"bytes,2,rep,name=config,proto3" json:"config,omitempty"` SourceID []string `protobuf:"bytes,3,rep,name=sourceID,proto3" json:"sourceID,omitempty"` WorkerName string `protobuf:"bytes,4,opt,name=workerName,proto3" json:"workerName,omitempty"` } func (m *OperateSourceRequest) Reset() { *m = OperateSourceRequest{} } func (m *OperateSourceRequest) String() string { return proto.CompactTextString(m) } func (*OperateSourceRequest) ProtoMessage() {} func (*OperateSourceRequest) Descriptor() ([]byte, []int) { return fileDescriptor_f9bef11f2a341f03, []int{19} } func (m *OperateSourceRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } func (m *OperateSourceRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_OperateSourceRequest.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) if err != nil { return nil, err } return b[:n], nil } } func (m *OperateSourceRequest) XXX_Merge(src proto.Message) { xxx_messageInfo_OperateSourceRequest.Merge(m, src) } func (m *OperateSourceRequest) XXX_Size() int { return m.Size() } func (m *OperateSourceRequest) XXX_DiscardUnknown() { xxx_messageInfo_OperateSourceRequest.DiscardUnknown(m) } var xxx_messageInfo_OperateSourceRequest proto.InternalMessageInfo func (m *OperateSourceRequest) GetOp() SourceOp { if m != nil { return m.Op } return SourceOp_InvalidSourceOp } func (m *OperateSourceRequest) GetConfig() []string { if m != nil { return m.Config } return nil } func (m *OperateSourceRequest) GetSourceID() []string { if m != nil { return m.SourceID } return nil } func (m *OperateSourceRequest) GetWorkerName() string { if m != nil { return m.WorkerName } return "" } type OperateSourceResponse struct { Result bool `protobuf:"varint,1,opt,name=result,proto3" json:"result,omitempty"` Msg string `protobuf:"bytes,2,opt,name=msg,proto3" json:"msg,omitempty"` Sources []*CommonWorkerResponse `protobuf:"bytes,3,rep,name=sources,proto3" json:"sources,omitempty"` } func (m *OperateSourceResponse) Reset() { *m = OperateSourceResponse{} } func (m *OperateSourceResponse) String() string { return proto.CompactTextString(m) } func (*OperateSourceResponse) ProtoMessage() {} func (*OperateSourceResponse) Descriptor() ([]byte, []int) { return fileDescriptor_f9bef11f2a341f03, []int{20} } func (m *OperateSourceResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } func (m *OperateSourceResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_OperateSourceResponse.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) if err != nil { return nil, err } return b[:n], nil } } func (m *OperateSourceResponse) XXX_Merge(src proto.Message) { xxx_messageInfo_OperateSourceResponse.Merge(m, src) } func (m *OperateSourceResponse) XXX_Size() int { return m.Size() } func (m *OperateSourceResponse) XXX_DiscardUnknown() { xxx_messageInfo_OperateSourceResponse.DiscardUnknown(m) } var xxx_messageInfo_OperateSourceResponse proto.InternalMessageInfo func (m *OperateSourceResponse) GetResult() bool { if m != nil { return m.Result } return false } func (m *OperateSourceResponse) GetMsg() string { if m != nil { return m.Msg } return "" } func (m *OperateSourceResponse) GetSources() []*CommonWorkerResponse { if m != nil { return m.Sources } return nil } type RegisterWorkerRequest struct { Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` Address string `protobuf:"bytes,2,opt,name=address,proto3" json:"address,omitempty"` } func (m *RegisterWorkerRequest) Reset() { *m = RegisterWorkerRequest{} } func (m *RegisterWorkerRequest) String() string { return proto.CompactTextString(m) } func (*RegisterWorkerRequest) ProtoMessage() {} func (*RegisterWorkerRequest) Descriptor() ([]byte, []int) { return fileDescriptor_f9bef11f2a341f03, []int{21} } func (m *RegisterWorkerRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } func (m *RegisterWorkerRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_RegisterWorkerRequest.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) if err != nil { return nil, err } return b[:n], nil } } func (m *RegisterWorkerRequest) XXX_Merge(src proto.Message) { xxx_messageInfo_RegisterWorkerRequest.Merge(m, src) } func (m *RegisterWorkerRequest) XXX_Size() int { return m.Size() } func (m *RegisterWorkerRequest) XXX_DiscardUnknown() { xxx_messageInfo_RegisterWorkerRequest.DiscardUnknown(m) } var xxx_messageInfo_RegisterWorkerRequest proto.InternalMessageInfo func (m *RegisterWorkerRequest) GetName() string { if m != nil { return m.Name } return "" } func (m *RegisterWorkerRequest) GetAddress() string { if m != nil { return m.Address } return "" } type RegisterWorkerResponse struct { Result bool `protobuf:"varint,1,opt,name=result,proto3" json:"result,omitempty"` Msg string `protobuf:"bytes,2,opt,name=msg,proto3" json:"msg,omitempty"` } func (m *RegisterWorkerResponse) Reset() { *m = RegisterWorkerResponse{} } func (m *RegisterWorkerResponse) String() string { return proto.CompactTextString(m) } func (*RegisterWorkerResponse) ProtoMessage() {} func (*RegisterWorkerResponse) Descriptor() ([]byte, []int) { return fileDescriptor_f9bef11f2a341f03, []int{22} } func (m *RegisterWorkerResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } func (m *RegisterWorkerResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_RegisterWorkerResponse.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) if err != nil { return nil, err } return b[:n], nil } } func (m *RegisterWorkerResponse) XXX_Merge(src proto.Message) { xxx_messageInfo_RegisterWorkerResponse.Merge(m, src) } func (m *RegisterWorkerResponse) XXX_Size() int { return m.Size() } func (m *RegisterWorkerResponse) XXX_DiscardUnknown() { xxx_messageInfo_RegisterWorkerResponse.DiscardUnknown(m) } var xxx_messageInfo_RegisterWorkerResponse proto.InternalMessageInfo func (m *RegisterWorkerResponse) GetResult() bool { if m != nil { return m.Result } return false } func (m *RegisterWorkerResponse) GetMsg() string { if m != nil { return m.Msg } return "" } type OfflineMemberRequest struct { Type string `protobuf:"bytes,1,opt,name=type,proto3" json:"type,omitempty"` Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"` } func (m *OfflineMemberRequest) Reset() { *m = OfflineMemberRequest{} } func (m *OfflineMemberRequest) String() string { return proto.CompactTextString(m) } func (*OfflineMemberRequest) ProtoMessage() {} func (*OfflineMemberRequest) Descriptor() ([]byte, []int) { return fileDescriptor_f9bef11f2a341f03, []int{23} } func (m *OfflineMemberRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } func (m *OfflineMemberRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_OfflineMemberRequest.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) if err != nil { return nil, err } return b[:n], nil } } func (m *OfflineMemberRequest) XXX_Merge(src proto.Message) { xxx_messageInfo_OfflineMemberRequest.Merge(m, src) } func (m *OfflineMemberRequest) XXX_Size() int { return m.Size() } func (m *OfflineMemberRequest) XXX_DiscardUnknown() { xxx_messageInfo_OfflineMemberRequest.DiscardUnknown(m) } var xxx_messageInfo_OfflineMemberRequest proto.InternalMessageInfo func (m *OfflineMemberRequest) GetType() string { if m != nil { return m.Type } return "" } func (m *OfflineMemberRequest) GetName() string { if m != nil { return m.Name } return "" } type OfflineMemberResponse struct { Result bool `protobuf:"varint,1,opt,name=result,proto3" json:"result,omitempty"` Msg string `protobuf:"bytes,2,opt,name=msg,proto3" json:"msg,omitempty"` } func (m *OfflineMemberResponse) Reset() { *m = OfflineMemberResponse{} } func (m *OfflineMemberResponse) String() string { return proto.CompactTextString(m) } func (*OfflineMemberResponse) ProtoMessage() {} func (*OfflineMemberResponse) Descriptor() ([]byte, []int) { return fileDescriptor_f9bef11f2a341f03, []int{24} } func (m *OfflineMemberResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } func (m *OfflineMemberResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_OfflineMemberResponse.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) if err != nil { return nil, err } return b[:n], nil } } func (m *OfflineMemberResponse) XXX_Merge(src proto.Message) { xxx_messageInfo_OfflineMemberResponse.Merge(m, src) } func (m *OfflineMemberResponse) XXX_Size() int { return m.Size() } func (m *OfflineMemberResponse) XXX_DiscardUnknown() { xxx_messageInfo_OfflineMemberResponse.DiscardUnknown(m) } var xxx_messageInfo_OfflineMemberResponse proto.InternalMessageInfo func (m *OfflineMemberResponse) GetResult() bool { if m != nil { return m.Result } return false } func (m *OfflineMemberResponse) GetMsg() string { if m != nil { return m.Msg } return "" } type OperateLeaderRequest struct { Op LeaderOp `protobuf:"varint,1,opt,name=op,proto3,enum=pb.LeaderOp" json:"op,omitempty"` } func (m *OperateLeaderRequest) Reset() { *m = OperateLeaderRequest{} } func (m *OperateLeaderRequest) String() string { return proto.CompactTextString(m) } func (*OperateLeaderRequest) ProtoMessage() {} func (*OperateLeaderRequest) Descriptor() ([]byte, []int) { return fileDescriptor_f9bef11f2a341f03, []int{25} } func (m *OperateLeaderRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } func (m *OperateLeaderRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_OperateLeaderRequest.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) if err != nil { return nil, err } return b[:n], nil } } func (m *OperateLeaderRequest) XXX_Merge(src proto.Message) { xxx_messageInfo_OperateLeaderRequest.Merge(m, src) } func (m *OperateLeaderRequest) XXX_Size() int { return m.Size() } func (m *OperateLeaderRequest) XXX_DiscardUnknown() { xxx_messageInfo_OperateLeaderRequest.DiscardUnknown(m) } var xxx_messageInfo_OperateLeaderRequest proto.InternalMessageInfo func (m *OperateLeaderRequest) GetOp() LeaderOp { if m != nil { return m.Op } return LeaderOp_InvalidLeaderOp } type OperateLeaderResponse struct { Result bool `protobuf:"varint,1,opt,name=result,proto3" json:"result,omitempty"` Msg string `protobuf:"bytes,2,opt,name=msg,proto3" json:"msg,omitempty"` } func (m *OperateLeaderResponse) Reset() { *m = OperateLeaderResponse{} } func (m *OperateLeaderResponse) String() string { return proto.CompactTextString(m) } func (*OperateLeaderResponse) ProtoMessage() {} func (*OperateLeaderResponse) Descriptor() ([]byte, []int) { return fileDescriptor_f9bef11f2a341f03, []int{26} } func (m *OperateLeaderResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } func (m *OperateLeaderResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_OperateLeaderResponse.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) if err != nil { return nil, err } return b[:n], nil } } func (m *OperateLeaderResponse) XXX_Merge(src proto.Message) { xxx_messageInfo_OperateLeaderResponse.Merge(m, src) } func (m *OperateLeaderResponse) XXX_Size() int { return m.Size() } func (m *OperateLeaderResponse) XXX_DiscardUnknown() { xxx_messageInfo_OperateLeaderResponse.DiscardUnknown(m) } var xxx_messageInfo_OperateLeaderResponse proto.InternalMessageInfo func (m *OperateLeaderResponse) GetResult() bool { if m != nil { return m.Result } return false } func (m *OperateLeaderResponse) GetMsg() string { if m != nil { return m.Msg } return "" } type MasterInfo struct { Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` MemberID uint64 `protobuf:"varint,2,opt,name=memberID,proto3" json:"memberID,omitempty"` Alive bool `protobuf:"varint,3,opt,name=alive,proto3" json:"alive,omitempty"` PeerURLs []string `protobuf:"bytes,4,rep,name=peerURLs,proto3" json:"peerURLs,omitempty"` ClientURLs []string `protobuf:"bytes,5,rep,name=clientURLs,proto3" json:"clientURLs,omitempty"` } func (m *MasterInfo) Reset() { *m = MasterInfo{} } func (m *MasterInfo) String() string { return proto.CompactTextString(m) } func (*MasterInfo) ProtoMessage() {} func (*MasterInfo) Descriptor() ([]byte, []int) { return fileDescriptor_f9bef11f2a341f03, []int{27} } func (m *MasterInfo) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } func (m *MasterInfo) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_MasterInfo.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) if err != nil { return nil, err } return b[:n], nil } } func (m *MasterInfo) XXX_Merge(src proto.Message) { xxx_messageInfo_MasterInfo.Merge(m, src) } func (m *MasterInfo) XXX_Size() int { return m.Size() } func (m *MasterInfo) XXX_DiscardUnknown() { xxx_messageInfo_MasterInfo.DiscardUnknown(m) } var xxx_messageInfo_MasterInfo proto.InternalMessageInfo func (m *MasterInfo) GetName() string { if m != nil { return m.Name } return "" } func (m *MasterInfo) GetMemberID() uint64 { if m != nil { return m.MemberID } return 0 } func (m *MasterInfo) GetAlive() bool { if m != nil { return m.Alive } return false } func (m *MasterInfo) GetPeerURLs() []string { if m != nil { return m.PeerURLs } return nil } func (m *MasterInfo) GetClientURLs() []string { if m != nil { return m.ClientURLs } return nil } type WorkerInfo struct { Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` Addr string `protobuf:"bytes,2,opt,name=addr,proto3" json:"addr,omitempty"` Stage string `protobuf:"bytes,3,opt,name=stage,proto3" json:"stage,omitempty"` Source string `protobuf:"bytes,4,opt,name=source,proto3" json:"source,omitempty"` } func (m *WorkerInfo) Reset() { *m = WorkerInfo{} } func (m *WorkerInfo) String() string { return proto.CompactTextString(m) } func (*WorkerInfo) ProtoMessage() {} func (*WorkerInfo) Descriptor() ([]byte, []int) { return fileDescriptor_f9bef11f2a341f03, []int{28} } func (m *WorkerInfo) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } func (m *WorkerInfo) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_WorkerInfo.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) if err != nil { return nil, err } return b[:n], nil } } func (m *WorkerInfo) XXX_Merge(src proto.Message) { xxx_messageInfo_WorkerInfo.Merge(m, src) } func (m *WorkerInfo) XXX_Size() int { return m.Size() } func (m *WorkerInfo) XXX_DiscardUnknown() { xxx_messageInfo_WorkerInfo.DiscardUnknown(m) } var xxx_messageInfo_WorkerInfo proto.InternalMessageInfo func (m *WorkerInfo) GetName() string { if m != nil { return m.Name } return "" } func (m *WorkerInfo) GetAddr() string { if m != nil { return m.Addr } return "" } func (m *WorkerInfo) GetStage() string { if m != nil { return m.Stage } return "" } func (m *WorkerInfo) GetSource() string { if m != nil { return m.Source } return "" } type ListLeaderMember struct { Msg string `protobuf:"bytes,1,opt,name=msg,proto3" json:"msg,omitempty"` Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"` Addr string `protobuf:"bytes,3,opt,name=addr,proto3" json:"addr,omitempty"` } func (m *ListLeaderMember) Reset() { *m = ListLeaderMember{} } func (m *ListLeaderMember) String() string { return proto.CompactTextString(m) } func (*ListLeaderMember) ProtoMessage() {} func (*ListLeaderMember) Descriptor() ([]byte, []int) { return fileDescriptor_f9bef11f2a341f03, []int{29} } func (m *ListLeaderMember) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } func (m *ListLeaderMember) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_ListLeaderMember.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) if err != nil { return nil, err } return b[:n], nil } } func (m *ListLeaderMember) XXX_Merge(src proto.Message) { xxx_messageInfo_ListLeaderMember.Merge(m, src) } func (m *ListLeaderMember) XXX_Size() int { return m.Size() } func (m *ListLeaderMember) XXX_DiscardUnknown() { xxx_messageInfo_ListLeaderMember.DiscardUnknown(m) } var xxx_messageInfo_ListLeaderMember proto.InternalMessageInfo func (m *ListLeaderMember) GetMsg() string { if m != nil { return m.Msg } return "" } func (m *ListLeaderMember) GetName() string { if m != nil { return m.Name } return "" } func (m *ListLeaderMember) GetAddr() string { if m != nil { return m.Addr } return "" } type ListMasterMember struct { Msg string `protobuf:"bytes,1,opt,name=msg,proto3" json:"msg,omitempty"` Masters []*MasterInfo `protobuf:"bytes,2,rep,name=masters,proto3" json:"masters,omitempty"` } func (m *ListMasterMember) Reset() { *m = ListMasterMember{} } func (m *ListMasterMember) String() string { return proto.CompactTextString(m) } func (*ListMasterMember) ProtoMessage() {} func (*ListMasterMember) Descriptor() ([]byte, []int) { return fileDescriptor_f9bef11f2a341f03, []int{30} } func (m *ListMasterMember) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } func (m *ListMasterMember) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_ListMasterMember.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) if err != nil { return nil, err } return b[:n], nil } } func (m *ListMasterMember) XXX_Merge(src proto.Message) { xxx_messageInfo_ListMasterMember.Merge(m, src) } func (m *ListMasterMember) XXX_Size() int { return m.Size() } func (m *ListMasterMember) XXX_DiscardUnknown() { xxx_messageInfo_ListMasterMember.DiscardUnknown(m) } var xxx_messageInfo_ListMasterMember proto.InternalMessageInfo func (m *ListMasterMember) GetMsg() string { if m != nil { return m.Msg } return "" } func (m *ListMasterMember) GetMasters() []*MasterInfo { if m != nil { return m.Masters } return nil } type ListWorkerMember struct { Msg string `protobuf:"bytes,1,opt,name=msg,proto3" json:"msg,omitempty"` Workers []*WorkerInfo `protobuf:"bytes,2,rep,name=workers,proto3" json:"workers,omitempty"` } func (m *ListWorkerMember) Reset() { *m = ListWorkerMember{} } func (m *ListWorkerMember) String() string { return proto.CompactTextString(m) } func (*ListWorkerMember) ProtoMessage() {} func (*ListWorkerMember) Descriptor() ([]byte, []int) { return fileDescriptor_f9bef11f2a341f03, []int{31} } func (m *ListWorkerMember) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } func (m *ListWorkerMember) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_ListWorkerMember.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) if err != nil { return nil, err } return b[:n], nil } } func (m *ListWorkerMember) XXX_Merge(src proto.Message) { xxx_messageInfo_ListWorkerMember.Merge(m, src) } func (m *ListWorkerMember) XXX_Size() int { return m.Size() } func (m *ListWorkerMember) XXX_DiscardUnknown() { xxx_messageInfo_ListWorkerMember.DiscardUnknown(m) } var xxx_messageInfo_ListWorkerMember proto.InternalMessageInfo func (m *ListWorkerMember) GetMsg() string { if m != nil { return m.Msg } return "" } func (m *ListWorkerMember) GetWorkers() []*WorkerInfo { if m != nil { return m.Workers } return nil } type Members struct { // Types that are valid to be assigned to Member: // *Members_Leader // *Members_Master // *Members_Worker Member isMembers_Member `protobuf_oneof:"member"` } func (m *Members) Reset() { *m = Members{} } func (m *Members) String() string { return proto.CompactTextString(m) } func (*Members) ProtoMessage() {} func (*Members) Descriptor() ([]byte, []int) { return fileDescriptor_f9bef11f2a341f03, []int{32} } func (m *Members) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } func (m *Members) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_Members.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) if err != nil { return nil, err } return b[:n], nil } } func (m *Members) XXX_Merge(src proto.Message) { xxx_messageInfo_Members.Merge(m, src) } func (m *Members) XXX_Size() int { return m.Size() } func (m *Members) XXX_DiscardUnknown() { xxx_messageInfo_Members.DiscardUnknown(m) } var xxx_messageInfo_Members proto.InternalMessageInfo type isMembers_Member interface { isMembers_Member() MarshalTo([]byte) (int, error) Size() int } type Members_Leader struct { Leader *ListLeaderMember `protobuf:"bytes,1,opt,name=leader,proto3,oneof" json:"leader,omitempty"` } type Members_Master struct { Master *ListMasterMember `protobuf:"bytes,2,opt,name=master,proto3,oneof" json:"master,omitempty"` } type Members_Worker struct { Worker *ListWorkerMember `protobuf:"bytes,3,opt,name=worker,proto3,oneof" json:"worker,omitempty"` } func (*Members_Leader) isMembers_Member() {} func (*Members_Master) isMembers_Member() {} func (*Members_Worker) isMembers_Member() {} func (m *Members) GetMember() isMembers_Member { if m != nil { return m.Member } return nil } func (m *Members) GetLeader() *ListLeaderMember { if x, ok := m.GetMember().(*Members_Leader); ok { return x.Leader } return nil } func (m *Members) GetMaster() *ListMasterMember { if x, ok := m.GetMember().(*Members_Master); ok { return x.Master } return nil } func (m *Members) GetWorker() *ListWorkerMember { if x, ok := m.GetMember().(*Members_Worker); ok { return x.Worker } return nil } // XXX_OneofWrappers is for the internal use of the proto package. func (*Members) XXX_OneofWrappers() []interface{} { return []interface{}{ (*Members_Leader)(nil), (*Members_Master)(nil), (*Members_Worker)(nil), } } type ListMemberRequest struct { Leader bool `protobuf:"varint,1,opt,name=leader,proto3" json:"leader,omitempty"` Master bool `protobuf:"varint,2,opt,name=master,proto3" json:"master,omitempty"` Worker bool `protobuf:"varint,3,opt,name=worker,proto3" json:"worker,omitempty"` Names []string `protobuf:"bytes,4,rep,name=names,proto3" json:"names,omitempty"` } func (m *ListMemberRequest) Reset() { *m = ListMemberRequest{} } func (m *ListMemberRequest) String() string { return proto.CompactTextString(m) } func (*ListMemberRequest) ProtoMessage() {} func (*ListMemberRequest) Descriptor() ([]byte, []int) { return fileDescriptor_f9bef11f2a341f03, []int{33} } func (m *ListMemberRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } func (m *ListMemberRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_ListMemberRequest.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) if err != nil { return nil, err } return b[:n], nil } } func (m *ListMemberRequest) XXX_Merge(src proto.Message) { xxx_messageInfo_ListMemberRequest.Merge(m, src) } func (m *ListMemberRequest) XXX_Size() int { return m.Size() } func (m *ListMemberRequest) XXX_DiscardUnknown() { xxx_messageInfo_ListMemberRequest.DiscardUnknown(m) } var xxx_messageInfo_ListMemberRequest proto.InternalMessageInfo func (m *ListMemberRequest) GetLeader() bool { if m != nil { return m.Leader } return false } func (m *ListMemberRequest) GetMaster() bool { if m != nil { return m.Master } return false } func (m *ListMemberRequest) GetWorker() bool { if m != nil { return m.Worker } return false } func (m *ListMemberRequest) GetNames() []string { if m != nil { return m.Names } return nil } type ListMemberResponse struct { Result bool `protobuf:"varint,1,opt,name=result,proto3" json:"result,omitempty"` Msg string `protobuf:"bytes,2,opt,name=msg,proto3" json:"msg,omitempty"` Members []*Members `protobuf:"bytes,3,rep,name=members,proto3" json:"members,omitempty"` } func (m *ListMemberResponse) Reset() { *m = ListMemberResponse{} } func (m *ListMemberResponse) String() string { return proto.CompactTextString(m) } func (*ListMemberResponse) ProtoMessage() {} func (*ListMemberResponse) Descriptor() ([]byte, []int) { return fileDescriptor_f9bef11f2a341f03, []int{34} } func (m *ListMemberResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } func (m *ListMemberResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_ListMemberResponse.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) if err != nil { return nil, err } return b[:n], nil } } func (m *ListMemberResponse) XXX_Merge(src proto.Message) { xxx_messageInfo_ListMemberResponse.Merge(m, src) } func (m *ListMemberResponse) XXX_Size() int { return m.Size() } func (m *ListMemberResponse) XXX_DiscardUnknown() { xxx_messageInfo_ListMemberResponse.DiscardUnknown(m) } var xxx_messageInfo_ListMemberResponse proto.InternalMessageInfo func (m *ListMemberResponse) GetResult() bool { if m != nil { return m.Result } return false } func (m *ListMemberResponse) GetMsg() string { if m != nil { return m.Msg } return "" } func (m *ListMemberResponse) GetMembers() []*Members { if m != nil { return m.Members } return nil } type OperateSchemaRequest struct { Op SchemaOp `protobuf:"varint,1,opt,name=op,proto3,enum=pb.SchemaOp" json:"op,omitempty"` Task string `protobuf:"bytes,2,opt,name=task,proto3" json:"task,omitempty"` Sources []string `protobuf:"bytes,3,rep,name=sources,proto3" json:"sources,omitempty"` Database string `protobuf:"bytes,4,opt,name=database,proto3" json:"database,omitempty"` Table string `protobuf:"bytes,5,opt,name=table,proto3" json:"table,omitempty"` Schema string `protobuf:"bytes,6,opt,name=schema,proto3" json:"schema,omitempty"` Flush bool `protobuf:"varint,7,opt,name=flush,proto3" json:"flush,omitempty"` Sync bool `protobuf:"varint,8,opt,name=sync,proto3" json:"sync,omitempty"` FromSource bool `protobuf:"varint,9,opt,name=fromSource,proto3" json:"fromSource,omitempty"` FromTarget bool `protobuf:"varint,10,opt,name=fromTarget,proto3" json:"fromTarget,omitempty"` } func (m *OperateSchemaRequest) Reset() { *m = OperateSchemaRequest{} } func (m *OperateSchemaRequest) String() string { return proto.CompactTextString(m) } func (*OperateSchemaRequest) ProtoMessage() {} func (*OperateSchemaRequest) Descriptor() ([]byte, []int) { return fileDescriptor_f9bef11f2a341f03, []int{35} } func (m *OperateSchemaRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } func (m *OperateSchemaRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_OperateSchemaRequest.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) if err != nil { return nil, err } return b[:n], nil } } func (m *OperateSchemaRequest) XXX_Merge(src proto.Message) { xxx_messageInfo_OperateSchemaRequest.Merge(m, src) } func (m *OperateSchemaRequest) XXX_Size() int { return m.Size() } func (m *OperateSchemaRequest) XXX_DiscardUnknown() { xxx_messageInfo_OperateSchemaRequest.DiscardUnknown(m) } var xxx_messageInfo_OperateSchemaRequest proto.InternalMessageInfo func (m *OperateSchemaRequest) GetOp() SchemaOp { if m != nil { return m.Op } return SchemaOp_InvalidSchemaOp } func (m *OperateSchemaRequest) GetTask() string { if m != nil { return m.Task } return "" } func (m *OperateSchemaRequest) GetSources() []string { if m != nil { return m.Sources } return nil } func (m *OperateSchemaRequest) GetDatabase() string { if m != nil { return m.Database } return "" } func (m *OperateSchemaRequest) GetTable() string { if m != nil { return m.Table } return "" } func (m *OperateSchemaRequest) GetSchema() string { if m != nil { return m.Schema } return "" } func (m *OperateSchemaRequest) GetFlush() bool { if m != nil { return m.Flush } return false } func (m *OperateSchemaRequest) GetSync() bool { if m != nil { return m.Sync } return false } func (m *OperateSchemaRequest) GetFromSource() bool { if m != nil { return m.FromSource } return false } func (m *OperateSchemaRequest) GetFromTarget() bool { if m != nil { return m.FromTarget } return false } type OperateSchemaResponse struct { Result bool `protobuf:"varint,1,opt,name=result,proto3" json:"result,omitempty"` Msg string `protobuf:"bytes,2,opt,name=msg,proto3" json:"msg,omitempty"` Sources []*CommonWorkerResponse `protobuf:"bytes,3,rep,name=sources,proto3" json:"sources,omitempty"` } func (m *OperateSchemaResponse) Reset() { *m = OperateSchemaResponse{} } func (m *OperateSchemaResponse) String() string { return proto.CompactTextString(m) } func (*OperateSchemaResponse) ProtoMessage() {} func (*OperateSchemaResponse) Descriptor() ([]byte, []int) { return fileDescriptor_f9bef11f2a341f03, []int{36} } func (m *OperateSchemaResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } func (m *OperateSchemaResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_OperateSchemaResponse.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) if err != nil { return nil, err } return b[:n], nil } } func (m *OperateSchemaResponse) XXX_Merge(src proto.Message) { xxx_messageInfo_OperateSchemaResponse.Merge(m, src) } func (m *OperateSchemaResponse) XXX_Size() int { return m.Size() } func (m *OperateSchemaResponse) XXX_DiscardUnknown() { xxx_messageInfo_OperateSchemaResponse.DiscardUnknown(m) } var xxx_messageInfo_OperateSchemaResponse proto.InternalMessageInfo func (m *OperateSchemaResponse) GetResult() bool { if m != nil { return m.Result } return false } func (m *OperateSchemaResponse) GetMsg() string { if m != nil { return m.Msg } return "" } func (m *OperateSchemaResponse) GetSources() []*CommonWorkerResponse { if m != nil { return m.Sources } return nil } type GetSubTaskCfgRequest struct { // the task name Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` } func (m *GetSubTaskCfgRequest) Reset() { *m = GetSubTaskCfgRequest{} } func (m *GetSubTaskCfgRequest) String() string { return proto.CompactTextString(m) } func (*GetSubTaskCfgRequest) ProtoMessage() {} func (*GetSubTaskCfgRequest) Descriptor() ([]byte, []int) { return fileDescriptor_f9bef11f2a341f03, []int{37} } func (m *GetSubTaskCfgRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } func (m *GetSubTaskCfgRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_GetSubTaskCfgRequest.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) if err != nil { return nil, err } return b[:n], nil } } func (m *GetSubTaskCfgRequest) XXX_Merge(src proto.Message) { xxx_messageInfo_GetSubTaskCfgRequest.Merge(m, src) } func (m *GetSubTaskCfgRequest) XXX_Size() int { return m.Size() } func (m *GetSubTaskCfgRequest) XXX_DiscardUnknown() { xxx_messageInfo_GetSubTaskCfgRequest.DiscardUnknown(m) } var xxx_messageInfo_GetSubTaskCfgRequest proto.InternalMessageInfo func (m *GetSubTaskCfgRequest) GetName() string { if m != nil { return m.Name } return "" } type GetSubTaskCfgResponse struct { Result bool `protobuf:"varint,1,opt,name=result,proto3" json:"result,omitempty"` Msg string `protobuf:"bytes,2,opt,name=msg,proto3" json:"msg,omitempty"` Cfgs []string `protobuf:"bytes,3,rep,name=cfgs,proto3" json:"cfgs,omitempty"` } func (m *GetSubTaskCfgResponse) Reset() { *m = GetSubTaskCfgResponse{} } func (m *GetSubTaskCfgResponse) String() string { return proto.CompactTextString(m) } func (*GetSubTaskCfgResponse) ProtoMessage() {} func (*GetSubTaskCfgResponse) Descriptor() ([]byte, []int) { return fileDescriptor_f9bef11f2a341f03, []int{38} } func (m *GetSubTaskCfgResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } func (m *GetSubTaskCfgResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_GetSubTaskCfgResponse.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) if err != nil { return nil, err } return b[:n], nil } } func (m *GetSubTaskCfgResponse) XXX_Merge(src proto.Message) { xxx_messageInfo_GetSubTaskCfgResponse.Merge(m, src) } func (m *GetSubTaskCfgResponse) XXX_Size() int { return m.Size() } func (m *GetSubTaskCfgResponse) XXX_DiscardUnknown() { xxx_messageInfo_GetSubTaskCfgResponse.DiscardUnknown(m) } var xxx_messageInfo_GetSubTaskCfgResponse proto.InternalMessageInfo func (m *GetSubTaskCfgResponse) GetResult() bool { if m != nil { return m.Result } return false } func (m *GetSubTaskCfgResponse) GetMsg() string { if m != nil { return m.Msg } return "" } func (m *GetSubTaskCfgResponse) GetCfgs() []string { if m != nil { return m.Cfgs } return nil } type GetCfgRequest struct { Type CfgType `protobuf:"varint,1,opt,name=type,proto3,enum=pb.CfgType" json:"type,omitempty"` Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"` } func (m *GetCfgRequest) Reset() { *m = GetCfgRequest{} } func (m *GetCfgRequest) String() string { return proto.CompactTextString(m) } func (*GetCfgRequest) ProtoMessage() {} func (*GetCfgRequest) Descriptor() ([]byte, []int) { return fileDescriptor_f9bef11f2a341f03, []int{39} } func (m *GetCfgRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } func (m *GetCfgRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_GetCfgRequest.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) if err != nil { return nil, err } return b[:n], nil } } func (m *GetCfgRequest) XXX_Merge(src proto.Message) { xxx_messageInfo_GetCfgRequest.Merge(m, src) } func (m *GetCfgRequest) XXX_Size() int { return m.Size() } func (m *GetCfgRequest) XXX_DiscardUnknown() { xxx_messageInfo_GetCfgRequest.DiscardUnknown(m) } var xxx_messageInfo_GetCfgRequest proto.InternalMessageInfo func (m *GetCfgRequest) GetType() CfgType { if m != nil { return m.Type } return CfgType_InvalidType } func (m *GetCfgRequest) GetName() string { if m != nil { return m.Name } return "" } type GetCfgResponse struct { Result bool `protobuf:"varint,1,opt,name=result,proto3" json:"result,omitempty"` Msg string `protobuf:"bytes,2,opt,name=msg,proto3" json:"msg,omitempty"` Cfg string `protobuf:"bytes,3,opt,name=cfg,proto3" json:"cfg,omitempty"` } func (m *GetCfgResponse) Reset() { *m = GetCfgResponse{} } func (m *GetCfgResponse) String() string { return proto.CompactTextString(m) } func (*GetCfgResponse) ProtoMessage() {} func (*GetCfgResponse) Descriptor() ([]byte, []int) { return fileDescriptor_f9bef11f2a341f03, []int{40} } func (m *GetCfgResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } func (m *GetCfgResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_GetCfgResponse.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) if err != nil { return nil, err } return b[:n], nil } } func (m *GetCfgResponse) XXX_Merge(src proto.Message) { xxx_messageInfo_GetCfgResponse.Merge(m, src) } func (m *GetCfgResponse) XXX_Size() int { return m.Size() } func (m *GetCfgResponse) XXX_DiscardUnknown() { xxx_messageInfo_GetCfgResponse.DiscardUnknown(m) } var xxx_messageInfo_GetCfgResponse proto.InternalMessageInfo func (m *GetCfgResponse) GetResult() bool { if m != nil { return m.Result } return false } func (m *GetCfgResponse) GetMsg() string { if m != nil { return m.Msg } return "" } func (m *GetCfgResponse) GetCfg() string { if m != nil { return m.Cfg } return "" } type GetMasterCfgRequest struct { } func (m *GetMasterCfgRequest) Reset() { *m = GetMasterCfgRequest{} } func (m *GetMasterCfgRequest) String() string { return proto.CompactTextString(m) } func (*GetMasterCfgRequest) ProtoMessage() {} func (*GetMasterCfgRequest) Descriptor() ([]byte, []int) { return fileDescriptor_f9bef11f2a341f03, []int{41} } func (m *GetMasterCfgRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } func (m *GetMasterCfgRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_GetMasterCfgRequest.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) if err != nil { return nil, err } return b[:n], nil } } func (m *GetMasterCfgRequest) XXX_Merge(src proto.Message) { xxx_messageInfo_GetMasterCfgRequest.Merge(m, src) } func (m *GetMasterCfgRequest) XXX_Size() int { return m.Size() } func (m *GetMasterCfgRequest) XXX_DiscardUnknown() { xxx_messageInfo_GetMasterCfgRequest.DiscardUnknown(m) } var xxx_messageInfo_GetMasterCfgRequest proto.InternalMessageInfo type GetMasterCfgResponse struct { Cfg string `protobuf:"bytes,1,opt,name=cfg,proto3" json:"cfg,omitempty"` } func (m *GetMasterCfgResponse) Reset() { *m = GetMasterCfgResponse{} } func (m *GetMasterCfgResponse) String() string { return proto.CompactTextString(m) } func (*GetMasterCfgResponse) ProtoMessage() {} func (*GetMasterCfgResponse) Descriptor() ([]byte, []int) { return fileDescriptor_f9bef11f2a341f03, []int{42} } func (m *GetMasterCfgResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } func (m *GetMasterCfgResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_GetMasterCfgResponse.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) if err != nil { return nil, err } return b[:n], nil } } func (m *GetMasterCfgResponse) XXX_Merge(src proto.Message) { xxx_messageInfo_GetMasterCfgResponse.Merge(m, src) } func (m *GetMasterCfgResponse) XXX_Size() int { return m.Size() } func (m *GetMasterCfgResponse) XXX_DiscardUnknown() { xxx_messageInfo_GetMasterCfgResponse.DiscardUnknown(m) } var xxx_messageInfo_GetMasterCfgResponse proto.InternalMessageInfo func (m *GetMasterCfgResponse) GetCfg() string { if m != nil { return m.Cfg } return "" } type HandleErrorRequest struct { Op ErrorOp `protobuf:"varint,1,opt,name=op,proto3,enum=pb.ErrorOp" json:"op,omitempty"` Task string `protobuf:"bytes,2,opt,name=task,proto3" json:"task,omitempty"` Sources []string `protobuf:"bytes,3,rep,name=sources,proto3" json:"sources,omitempty"` BinlogPos string `protobuf:"bytes,4,opt,name=binlogPos,proto3" json:"binlogPos,omitempty"` Sqls []string `protobuf:"bytes,5,rep,name=sqls,proto3" json:"sqls,omitempty"` } func (m *HandleErrorRequest) Reset() { *m = HandleErrorRequest{} } func (m *HandleErrorRequest) String() string { return proto.CompactTextString(m) } func (*HandleErrorRequest) ProtoMessage() {} func (*HandleErrorRequest) Descriptor() ([]byte, []int) { return fileDescriptor_f9bef11f2a341f03, []int{43} } func (m *HandleErrorRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } func (m *HandleErrorRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_HandleErrorRequest.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) if err != nil { return nil, err } return b[:n], nil } } func (m *HandleErrorRequest) XXX_Merge(src proto.Message) { xxx_messageInfo_HandleErrorRequest.Merge(m, src) } func (m *HandleErrorRequest) XXX_Size() int { return m.Size() } func (m *HandleErrorRequest) XXX_DiscardUnknown() { xxx_messageInfo_HandleErrorRequest.DiscardUnknown(m) } var xxx_messageInfo_HandleErrorRequest proto.InternalMessageInfo func (m *HandleErrorRequest) GetOp() ErrorOp { if m != nil { return m.Op } return ErrorOp_InvalidErrorOp } func (m *HandleErrorRequest) GetTask() string { if m != nil { return m.Task } return "" } func (m *HandleErrorRequest) GetSources() []string { if m != nil { return m.Sources } return nil } func (m *HandleErrorRequest) GetBinlogPos() string { if m != nil { return m.BinlogPos } return "" } func (m *HandleErrorRequest) GetSqls() []string { if m != nil { return m.Sqls } return nil } type HandleErrorResponse struct { Result bool `protobuf:"varint,1,opt,name=result,proto3" json:"result,omitempty"` Msg string `protobuf:"bytes,2,opt,name=msg,proto3" json:"msg,omitempty"` Sources []*CommonWorkerResponse `protobuf:"bytes,3,rep,name=sources,proto3" json:"sources,omitempty"` } func (m *HandleErrorResponse) Reset() { *m = HandleErrorResponse{} } func (m *HandleErrorResponse) String() string { return proto.CompactTextString(m) } func (*HandleErrorResponse) ProtoMessage() {} func (*HandleErrorResponse) Descriptor() ([]byte, []int) { return fileDescriptor_f9bef11f2a341f03, []int{44} } func (m *HandleErrorResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } func (m *HandleErrorResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_HandleErrorResponse.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) if err != nil { return nil, err } return b[:n], nil } } func (m *HandleErrorResponse) XXX_Merge(src proto.Message) { xxx_messageInfo_HandleErrorResponse.Merge(m, src) } func (m *HandleErrorResponse) XXX_Size() int { return m.Size() } func (m *HandleErrorResponse) XXX_DiscardUnknown() { xxx_messageInfo_HandleErrorResponse.DiscardUnknown(m) } var xxx_messageInfo_HandleErrorResponse proto.InternalMessageInfo func (m *HandleErrorResponse) GetResult() bool { if m != nil { return m.Result } return false } func (m *HandleErrorResponse) GetMsg() string { if m != nil { return m.Msg } return "" } func (m *HandleErrorResponse) GetSources() []*CommonWorkerResponse { if m != nil { return m.Sources } return nil } type TransferSourceRequest struct { Source string `protobuf:"bytes,1,opt,name=source,proto3" json:"source,omitempty"` Worker string `protobuf:"bytes,2,opt,name=worker,proto3" json:"worker,omitempty"` } func (m *TransferSourceRequest) Reset() { *m = TransferSourceRequest{} } func (m *TransferSourceRequest) String() string { return proto.CompactTextString(m) } func (*TransferSourceRequest) ProtoMessage() {} func (*TransferSourceRequest) Descriptor() ([]byte, []int) { return fileDescriptor_f9bef11f2a341f03, []int{45} } func (m *TransferSourceRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } func (m *TransferSourceRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_TransferSourceRequest.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) if err != nil { return nil, err } return b[:n], nil } } func (m *TransferSourceRequest) XXX_Merge(src proto.Message) { xxx_messageInfo_TransferSourceRequest.Merge(m, src) } func (m *TransferSourceRequest) XXX_Size() int { return m.Size() } func (m *TransferSourceRequest) XXX_DiscardUnknown() { xxx_messageInfo_TransferSourceRequest.DiscardUnknown(m) } var xxx_messageInfo_TransferSourceRequest proto.InternalMessageInfo func (m *TransferSourceRequest) GetSource() string { if m != nil { return m.Source } return "" } func (m *TransferSourceRequest) GetWorker() string { if m != nil { return m.Worker } return "" } type TransferSourceResponse struct { Result bool `protobuf:"varint,1,opt,name=result,proto3" json:"result,omitempty"` Msg string `protobuf:"bytes,2,opt,name=msg,proto3" json:"msg,omitempty"` } func (m *TransferSourceResponse) Reset() { *m = TransferSourceResponse{} } func (m *TransferSourceResponse) String() string { return proto.CompactTextString(m) } func (*TransferSourceResponse) ProtoMessage() {} func (*TransferSourceResponse) Descriptor() ([]byte, []int) { return fileDescriptor_f9bef11f2a341f03, []int{46} } func (m *TransferSourceResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } func (m *TransferSourceResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_TransferSourceResponse.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) if err != nil { return nil, err } return b[:n], nil } } func (m *TransferSourceResponse) XXX_Merge(src proto.Message) { xxx_messageInfo_TransferSourceResponse.Merge(m, src) } func (m *TransferSourceResponse) XXX_Size() int { return m.Size() } func (m *TransferSourceResponse) XXX_DiscardUnknown() { xxx_messageInfo_TransferSourceResponse.DiscardUnknown(m) } var xxx_messageInfo_TransferSourceResponse proto.InternalMessageInfo func (m *TransferSourceResponse) GetResult() bool { if m != nil { return m.Result } return false } func (m *TransferSourceResponse) GetMsg() string { if m != nil { return m.Msg } return "" } type OperateRelayRequest struct { Op RelayOpV2 `protobuf:"varint,1,opt,name=op,proto3,enum=pb.RelayOpV2" json:"op,omitempty"` Source string `protobuf:"bytes,2,opt,name=source,proto3" json:"source,omitempty"` Worker []string `protobuf:"bytes,3,rep,name=worker,proto3" json:"worker,omitempty"` } func (m *OperateRelayRequest) Reset() { *m = OperateRelayRequest{} } func (m *OperateRelayRequest) String() string { return proto.CompactTextString(m) } func (*OperateRelayRequest) ProtoMessage() {} func (*OperateRelayRequest) Descriptor() ([]byte, []int) { return fileDescriptor_f9bef11f2a341f03, []int{47} } func (m *OperateRelayRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } func (m *OperateRelayRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_OperateRelayRequest.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) if err != nil { return nil, err } return b[:n], nil } } func (m *OperateRelayRequest) XXX_Merge(src proto.Message) { xxx_messageInfo_OperateRelayRequest.Merge(m, src) } func (m *OperateRelayRequest) XXX_Size() int { return m.Size() } func (m *OperateRelayRequest) XXX_DiscardUnknown() { xxx_messageInfo_OperateRelayRequest.DiscardUnknown(m) } var xxx_messageInfo_OperateRelayRequest proto.InternalMessageInfo func (m *OperateRelayRequest) GetOp() RelayOpV2 { if m != nil { return m.Op } return RelayOpV2_InvalidRelayOpV2 } func (m *OperateRelayRequest) GetSource() string { if m != nil { return m.Source } return "" } func (m *OperateRelayRequest) GetWorker() []string { if m != nil { return m.Worker } return nil } type OperateRelayResponse struct { Result bool `protobuf:"varint,1,opt,name=result,proto3" json:"result,omitempty"` Msg string `protobuf:"bytes,2,opt,name=msg,proto3" json:"msg,omitempty"` Sources []*CommonWorkerResponse `protobuf:"bytes,3,rep,name=sources,proto3" json:"sources,omitempty"` } func (m *OperateRelayResponse) Reset() { *m = OperateRelayResponse{} } func (m *OperateRelayResponse) String() string { return proto.CompactTextString(m) } func (*OperateRelayResponse) ProtoMessage() {} func (*OperateRelayResponse) Descriptor() ([]byte, []int) { return fileDescriptor_f9bef11f2a341f03, []int{48} } func (m *OperateRelayResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } func (m *OperateRelayResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_OperateRelayResponse.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) if err != nil { return nil, err } return b[:n], nil } } func (m *OperateRelayResponse) XXX_Merge(src proto.Message) { xxx_messageInfo_OperateRelayResponse.Merge(m, src) } func (m *OperateRelayResponse) XXX_Size() int { return m.Size() } func (m *OperateRelayResponse) XXX_DiscardUnknown() { xxx_messageInfo_OperateRelayResponse.DiscardUnknown(m) } var xxx_messageInfo_OperateRelayResponse proto.InternalMessageInfo func (m *OperateRelayResponse) GetResult() bool { if m != nil { return m.Result } return false } func (m *OperateRelayResponse) GetMsg() string { if m != nil { return m.Msg } return "" } func (m *OperateRelayResponse) GetSources() []*CommonWorkerResponse { if m != nil { return m.Sources } return nil } type StartValidationRequest struct { Mode string `protobuf:"bytes,1,opt,name=mode,proto3" json:"mode,omitempty"` FromTime string `protobuf:"bytes,2,opt,name=fromTime,proto3" json:"fromTime,omitempty"` Sources []string `protobuf:"bytes,3,rep,name=sources,proto3" json:"sources,omitempty"` TaskName string `protobuf:"bytes,4,opt,name=taskName,proto3" json:"taskName,omitempty"` } func (m *StartValidationRequest) Reset() { *m = StartValidationRequest{} } func (m *StartValidationRequest) String() string { return proto.CompactTextString(m) } func (*StartValidationRequest) ProtoMessage() {} func (*StartValidationRequest) Descriptor() ([]byte, []int) { return fileDescriptor_f9bef11f2a341f03, []int{49} } func (m *StartValidationRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } func (m *StartValidationRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_StartValidationRequest.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) if err != nil { return nil, err } return b[:n], nil } } func (m *StartValidationRequest) XXX_Merge(src proto.Message) { xxx_messageInfo_StartValidationRequest.Merge(m, src) } func (m *StartValidationRequest) XXX_Size() int { return m.Size() } func (m *StartValidationRequest) XXX_DiscardUnknown() { xxx_messageInfo_StartValidationRequest.DiscardUnknown(m) } var xxx_messageInfo_StartValidationRequest proto.InternalMessageInfo func (m *StartValidationRequest) GetMode() string { if m != nil { return m.Mode } return "" } func (m *StartValidationRequest) GetFromTime() string { if m != nil { return m.FromTime } return "" } func (m *StartValidationRequest) GetSources() []string { if m != nil { return m.Sources } return nil } func (m *StartValidationRequest) GetTaskName() string { if m != nil { return m.TaskName } return "" } type StartValidationResponse struct { Result bool `protobuf:"varint,1,opt,name=result,proto3" json:"result,omitempty"` Msg string `protobuf:"bytes,2,opt,name=msg,proto3" json:"msg,omitempty"` Sources []*CommonWorkerResponse `protobuf:"bytes,3,rep,name=sources,proto3" json:"sources,omitempty"` } func (m *StartValidationResponse) Reset() { *m = StartValidationResponse{} } func (m *StartValidationResponse) String() string { return proto.CompactTextString(m) } func (*StartValidationResponse) ProtoMessage() {} func (*StartValidationResponse) Descriptor() ([]byte, []int) { return fileDescriptor_f9bef11f2a341f03, []int{50} } func (m *StartValidationResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } func (m *StartValidationResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_StartValidationResponse.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) if err != nil { return nil, err } return b[:n], nil } } func (m *StartValidationResponse) XXX_Merge(src proto.Message) { xxx_messageInfo_StartValidationResponse.Merge(m, src) } func (m *StartValidationResponse) XXX_Size() int { return m.Size() } func (m *StartValidationResponse) XXX_DiscardUnknown() { xxx_messageInfo_StartValidationResponse.DiscardUnknown(m) } var xxx_messageInfo_StartValidationResponse proto.InternalMessageInfo func (m *StartValidationResponse) GetResult() bool { if m != nil { return m.Result } return false } func (m *StartValidationResponse) GetMsg() string { if m != nil { return m.Msg } return "" } func (m *StartValidationResponse) GetSources() []*CommonWorkerResponse { if m != nil { return m.Sources } return nil } type StopValidationRequest struct { Sources []string `protobuf:"bytes,1,rep,name=sources,proto3" json:"sources,omitempty"` TaskName string `protobuf:"bytes,2,opt,name=taskName,proto3" json:"taskName,omitempty"` } func (m *StopValidationRequest) Reset() { *m = StopValidationRequest{} } func (m *StopValidationRequest) String() string { return proto.CompactTextString(m) } func (*StopValidationRequest) ProtoMessage() {} func (*StopValidationRequest) Descriptor() ([]byte, []int) { return fileDescriptor_f9bef11f2a341f03, []int{51} } func (m *StopValidationRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } func (m *StopValidationRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_StopValidationRequest.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) if err != nil { return nil, err } return b[:n], nil } } func (m *StopValidationRequest) XXX_Merge(src proto.Message) { xxx_messageInfo_StopValidationRequest.Merge(m, src) } func (m *StopValidationRequest) XXX_Size() int { return m.Size() } func (m *StopValidationRequest) XXX_DiscardUnknown() { xxx_messageInfo_StopValidationRequest.DiscardUnknown(m) } var xxx_messageInfo_StopValidationRequest proto.InternalMessageInfo func (m *StopValidationRequest) GetSources() []string { if m != nil { return m.Sources } return nil } func (m *StopValidationRequest) GetTaskName() string { if m != nil { return m.TaskName } return "" } type StopValidationResponse struct { Result bool `protobuf:"varint,1,opt,name=result,proto3" json:"result,omitempty"` Msg string `protobuf:"bytes,2,opt,name=msg,proto3" json:"msg,omitempty"` Sources []*CommonWorkerResponse `protobuf:"bytes,3,rep,name=sources,proto3" json:"sources,omitempty"` } func (m *StopValidationResponse) Reset() { *m = StopValidationResponse{} } func (m *StopValidationResponse) String() string { return proto.CompactTextString(m) } func (*StopValidationResponse) ProtoMessage() {} func (*StopValidationResponse) Descriptor() ([]byte, []int) { return fileDescriptor_f9bef11f2a341f03, []int{52} } func (m *StopValidationResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } func (m *StopValidationResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_StopValidationResponse.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) if err != nil { return nil, err } return b[:n], nil } } func (m *StopValidationResponse) XXX_Merge(src proto.Message) { xxx_messageInfo_StopValidationResponse.Merge(m, src) } func (m *StopValidationResponse) XXX_Size() int { return m.Size() } func (m *StopValidationResponse) XXX_DiscardUnknown() { xxx_messageInfo_StopValidationResponse.DiscardUnknown(m) } var xxx_messageInfo_StopValidationResponse proto.InternalMessageInfo func (m *StopValidationResponse) GetResult() bool { if m != nil { return m.Result } return false } func (m *StopValidationResponse) GetMsg() string { if m != nil { return m.Msg } return "" } func (m *StopValidationResponse) GetSources() []*CommonWorkerResponse { if m != nil { return m.Sources } return nil } func init() { proto.RegisterEnum("pb.UnlockDDLLockOp", UnlockDDLLockOp_name, UnlockDDLLockOp_value) proto.RegisterEnum("pb.SourceOp", SourceOp_name, SourceOp_value) proto.RegisterEnum("pb.LeaderOp", LeaderOp_name, LeaderOp_value) proto.RegisterEnum("pb.CfgType", CfgType_name, CfgType_value) proto.RegisterEnum("pb.RelayOpV2", RelayOpV2_name, RelayOpV2_value) proto.RegisterType((*StartTaskRequest)(nil), "pb.StartTaskRequest") proto.RegisterType((*StartTaskResponse)(nil), "pb.StartTaskResponse") proto.RegisterType((*OperateTaskRequest)(nil), "pb.OperateTaskRequest") proto.RegisterType((*OperateTaskResponse)(nil), "pb.OperateTaskResponse") proto.RegisterType((*UpdateTaskRequest)(nil), "pb.UpdateTaskRequest") proto.RegisterType((*UpdateTaskResponse)(nil), "pb.UpdateTaskResponse") proto.RegisterType((*QueryStatusListRequest)(nil), "pb.QueryStatusListRequest") proto.RegisterType((*QueryStatusListResponse)(nil), "pb.QueryStatusListResponse") proto.RegisterType((*ShowDDLLocksRequest)(nil), "pb.ShowDDLLocksRequest") proto.RegisterType((*DDLLock)(nil), "pb.DDLLock") proto.RegisterType((*ShowDDLLocksResponse)(nil), "pb.ShowDDLLocksResponse") proto.RegisterType((*UnlockDDLLockRequest)(nil), "pb.UnlockDDLLockRequest") proto.RegisterType((*UnlockDDLLockResponse)(nil), "pb.UnlockDDLLockResponse") proto.RegisterType((*OperateWorkerRelayRequest)(nil), "pb.OperateWorkerRelayRequest") proto.RegisterType((*OperateWorkerRelayResponse)(nil), "pb.OperateWorkerRelayResponse") proto.RegisterType((*PurgeWorkerRelayRequest)(nil), "pb.PurgeWorkerRelayRequest") proto.RegisterType((*PurgeWorkerRelayResponse)(nil), "pb.PurgeWorkerRelayResponse") proto.RegisterType((*CheckTaskRequest)(nil), "pb.CheckTaskRequest") proto.RegisterType((*CheckTaskResponse)(nil), "pb.CheckTaskResponse") proto.RegisterType((*OperateSourceRequest)(nil), "pb.OperateSourceRequest") proto.RegisterType((*OperateSourceResponse)(nil), "pb.OperateSourceResponse") proto.RegisterType((*RegisterWorkerRequest)(nil), "pb.RegisterWorkerRequest") proto.RegisterType((*RegisterWorkerResponse)(nil), "pb.RegisterWorkerResponse") proto.RegisterType((*OfflineMemberRequest)(nil), "pb.OfflineMemberRequest") proto.RegisterType((*OfflineMemberResponse)(nil), "pb.OfflineMemberResponse") proto.RegisterType((*OperateLeaderRequest)(nil), "pb.OperateLeaderRequest") proto.RegisterType((*OperateLeaderResponse)(nil), "pb.OperateLeaderResponse") proto.RegisterType((*MasterInfo)(nil), "pb.MasterInfo") proto.RegisterType((*WorkerInfo)(nil), "pb.WorkerInfo") proto.RegisterType((*ListLeaderMember)(nil), "pb.ListLeaderMember") proto.RegisterType((*ListMasterMember)(nil), "pb.ListMasterMember") proto.RegisterType((*ListWorkerMember)(nil), "pb.ListWorkerMember") proto.RegisterType((*Members)(nil), "pb.Members") proto.RegisterType((*ListMemberRequest)(nil), "pb.ListMemberRequest") proto.RegisterType((*ListMemberResponse)(nil), "pb.ListMemberResponse") proto.RegisterType((*OperateSchemaRequest)(nil), "pb.OperateSchemaRequest") proto.RegisterType((*OperateSchemaResponse)(nil), "pb.OperateSchemaResponse") proto.RegisterType((*GetSubTaskCfgRequest)(nil), "pb.GetSubTaskCfgRequest") proto.RegisterType((*GetSubTaskCfgResponse)(nil), "pb.GetSubTaskCfgResponse") proto.RegisterType((*GetCfgRequest)(nil), "pb.GetCfgRequest") proto.RegisterType((*GetCfgResponse)(nil), "pb.GetCfgResponse") proto.RegisterType((*GetMasterCfgRequest)(nil), "pb.GetMasterCfgRequest") proto.RegisterType((*GetMasterCfgResponse)(nil), "pb.GetMasterCfgResponse") proto.RegisterType((*HandleErrorRequest)(nil), "pb.HandleErrorRequest") proto.RegisterType((*HandleErrorResponse)(nil), "pb.HandleErrorResponse") proto.RegisterType((*TransferSourceRequest)(nil), "pb.TransferSourceRequest") proto.RegisterType((*TransferSourceResponse)(nil), "pb.TransferSourceResponse") proto.RegisterType((*OperateRelayRequest)(nil), "pb.OperateRelayRequest") proto.RegisterType((*OperateRelayResponse)(nil), "pb.OperateRelayResponse") proto.RegisterType((*StartValidationRequest)(nil), "pb.StartValidationRequest") proto.RegisterType((*StartValidationResponse)(nil), "pb.StartValidationResponse") proto.RegisterType((*StopValidationRequest)(nil), "pb.StopValidationRequest") proto.RegisterType((*StopValidationResponse)(nil), "pb.StopValidationResponse") } func init() { proto.RegisterFile("dmmaster.proto", fileDescriptor_f9bef11f2a341f03) } var fileDescriptor_f9bef11f2a341f03 = []byte{ // 2331 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xcc, 0x5a, 0xcd, 0x6f, 0xdb, 0xc8, 0x15, 0x17, 0x25, 0xd9, 0x96, 0x9f, 0x3f, 0x22, 0x8f, 0x6d, 0x99, 0x61, 0x1c, 0xc5, 0xe1, 0x7e, 0xc0, 0x30, 0x8a, 0x18, 0x71, 0x7b, 0x5a, 0x60, 0x8b, 0x6e, 0xac, 0x6c, 0xd6, 0xa8, 0xb3, 0xde, 0xd2, 0x76, 0xda, 0x45, 0x81, 0xa2, 0x94, 0x34, 0x92, 0x09, 0x53, 0x24, 0x43, 0x52, 0xf6, 0x1a, 0xc1, 0xee, 0xa1, 0xa7, 0x9e, 0xfa, 0x81, 0x2d, 0xba, 0xc7, 0x1e, 0xfa, 0xcf, 0xf4, 0xb8, 0x40, 0x2f, 0xbd, 0x14, 0x28, 0x92, 0xde, 0xfb, 0x2f, 0x14, 0xf3, 0x66, 0x38, 0x1c, 0x7e, 0x48, 0x5b, 0x05, 0xa8, 0xb1, 0x37, 0xbe, 0x79, 0xa3, 0xf7, 0x7e, 0xef, 0x63, 0xde, 0xbc, 0x79, 0x10, 0xac, 0xf6, 0x47, 0x23, 0x3b, 0x8a, 0x69, 0xf8, 0x28, 0x08, 0xfd, 0xd8, 0x27, 0xd5, 0xa0, 0x6b, 0xac, 0xf6, 0x47, 0xd7, 0x7e, 0x78, 0x99, 0xac, 0x19, 0xdb, 0x43, 0xdf, 0x1f, 0xba, 0x74, 0xdf, 0x0e, 0x9c, 0x7d, 0xdb, 0xf3, 0xfc, 0xd8, 0x8e, 0x1d, 0xdf, 0x8b, 0x38, 0xd7, 0xfc, 0x0a, 0x9a, 0xa7, 0xb1, 0x1d, 0xc6, 0x67, 0x76, 0x74, 0x69, 0xd1, 0x97, 0x63, 0x1a, 0xc5, 0x84, 0x40, 0x3d, 0xb6, 0xa3, 0x4b, 0x5d, 0xdb, 0xd1, 0x76, 0x17, 0x2d, 0xfc, 0x26, 0x3a, 0x2c, 0x44, 0xfe, 0x38, 0xec, 0xd1, 0x48, 0xaf, 0xee, 0xd4, 0x76, 0x17, 0xad, 0x84, 0x24, 0x6d, 0x80, 0x90, 0x8e, 0xfc, 0x2b, 0xfa, 0x9c, 0xc6, 0xb6, 0x5e, 0xdb, 0xd1, 0x76, 0x1b, 0x96, 0xb2, 0x42, 0xb6, 0x61, 0x31, 0x42, 0x0d, 0xce, 0x88, 0xea, 0x75, 0x14, 0x99, 0x2e, 0x98, 0x5f, 0x6b, 0xb0, 0xa6, 0x00, 0x88, 0x02, 0xdf, 0x8b, 0x28, 0x69, 0xc1, 0x7c, 0x48, 0xa3, 0xb1, 0x1b, 0x23, 0x86, 0x86, 0x25, 0x28, 0xd2, 0x84, 0xda, 0x28, 0x1a, 0xea, 0x55, 0x94, 0xc2, 0x3e, 0xc9, 0x41, 0x8a, 0xab, 0xb6, 0x53, 0xdb, 0x5d, 0x3a, 0xd0, 0x1f, 0x05, 0xdd, 0x47, 0x87, 0xfe, 0x68, 0xe4, 0x7b, 0x3f, 0x47, 0x37, 0x24, 0x42, 0x53, 0xc4, 0x3b, 0xb0, 0xd4, 0xbb, 0xa0, 0x3d, 0xa6, 0x8e, 0xa9, 0xe0, 0x98, 0xd4, 0x25, 0xf3, 0x57, 0x40, 0x4e, 0x02, 0x1a, 0xda, 0x31, 0x55, 0xfd, 0x62, 0x40, 0xd5, 0x0f, 0x10, 0xd1, 0xea, 0x01, 0x30, 0x35, 0x8c, 0x79, 0x12, 0x58, 0x55, 0x3f, 0x60, 0x3e, 0xf3, 0xec, 0x11, 0x15, 0xd0, 0xf0, 0x5b, 0xf5, 0x59, 0x2d, 0xe3, 0x33, 0xf3, 0xf7, 0x1a, 0xac, 0x67, 0x14, 0x08, 0xbb, 0xa7, 0x69, 0x48, 0x7d, 0x52, 0x2d, 0xf3, 0x49, 0xad, 0xd4, 0x27, 0xf5, 0xff, 0xd1, 0x27, 0xe6, 0x47, 0xb0, 0x76, 0x1e, 0xf4, 0x73, 0x06, 0xcf, 0x94, 0x08, 0xe6, 0x9f, 0x34, 0x20, 0xaa, 0x8c, 0xef, 0x49, 0x2c, 0x3f, 0x86, 0xd6, 0xcf, 0xc6, 0x34, 0xbc, 0x39, 0x8d, 0xed, 0x78, 0x1c, 0x1d, 0x3b, 0x51, 0xac, 0x98, 0x87, 0x31, 0xd3, 0xca, 0x63, 0x96, 0x33, 0xef, 0x0a, 0xb6, 0x0a, 0x72, 0x66, 0x36, 0xf1, 0x71, 0xde, 0xc4, 0x2d, 0x66, 0xa2, 0x22, 0xb7, 0x18, 0x99, 0x43, 0x58, 0x3f, 0xbd, 0xf0, 0xaf, 0x3b, 0x9d, 0xe3, 0x63, 0xbf, 0x77, 0x19, 0xbd, 0x5d, 0x6c, 0xfe, 0xa2, 0xc1, 0x82, 0x90, 0x40, 0x56, 0xa1, 0x7a, 0xd4, 0x11, 0xbf, 0xab, 0x1e, 0x75, 0xa4, 0xa4, 0xaa, 0x22, 0x89, 0x40, 0x7d, 0xe4, 0xf7, 0xa9, 0xc8, 0x2a, 0xfc, 0x26, 0x1b, 0x30, 0xe7, 0x5f, 0x7b, 0x34, 0x14, 0x4e, 0xe6, 0x04, 0xdb, 0xd9, 0xe9, 0x1c, 0x47, 0xfa, 0x1c, 0x2a, 0xc4, 0x6f, 0xe6, 0x8f, 0xe8, 0xc6, 0xeb, 0xd1, 0xbe, 0x3e, 0x8f, 0xab, 0x82, 0x22, 0x06, 0x34, 0xc6, 0x9e, 0xe0, 0x2c, 0x20, 0x47, 0xd2, 0x66, 0x0f, 0x36, 0xb2, 0x66, 0xce, 0xec, 0xdb, 0x87, 0x30, 0xe7, 0xb2, 0x9f, 0x0a, 0xcf, 0x2e, 0x31, 0xcf, 0x0a, 0x71, 0x16, 0xe7, 0x98, 0xff, 0xd4, 0x60, 0xe3, 0xdc, 0x63, 0xdf, 0x09, 0x43, 0x78, 0x33, 0xef, 0x13, 0x13, 0x96, 0x43, 0x1a, 0xb8, 0x76, 0x8f, 0x9e, 0xa0, 0xc9, 0x5c, 0x4d, 0x66, 0x8d, 0xa5, 0xde, 0xc0, 0x0f, 0x7b, 0xd4, 0xc2, 0x5a, 0x27, 0x2a, 0x9f, 0xba, 0x44, 0xde, 0xc1, 0xe3, 0x5c, 0xc7, 0xe3, 0xbc, 0xce, 0xe0, 0x64, 0x74, 0x8b, 0x73, 0xad, 0x04, 0x6d, 0x2e, 0x5b, 0x59, 0x0d, 0x68, 0xf4, 0xed, 0xd8, 0xee, 0xda, 0x11, 0xd5, 0xe7, 0x11, 0x80, 0xa4, 0x59, 0x30, 0x62, 0xbb, 0xeb, 0x52, 0x7d, 0x81, 0x07, 0x03, 0x09, 0xf3, 0x23, 0xd8, 0xcc, 0x99, 0x37, 0xab, 0x17, 0x4d, 0x0b, 0xee, 0x8a, 0xca, 0x94, 0x1c, 0x39, 0xd7, 0xbe, 0x49, 0xdc, 0x74, 0x4f, 0xa9, 0x4f, 0xe8, 0x5f, 0xe4, 0x16, 0x0d, 0xc9, 0x65, 0xdf, 0x37, 0x1a, 0x18, 0x65, 0x42, 0x05, 0xb8, 0xa9, 0x52, 0xff, 0xbf, 0x65, 0xef, 0x1b, 0x0d, 0xb6, 0x3e, 0x1b, 0x87, 0xc3, 0x32, 0x63, 0x15, 0x7b, 0xb4, 0x42, 0x60, 0x1c, 0xcf, 0xee, 0xc5, 0xce, 0x15, 0x15, 0xa8, 0x24, 0x8d, 0xa7, 0x89, 0xdd, 0x74, 0x0c, 0x58, 0xcd, 0xc2, 0x6f, 0xb6, 0x7f, 0xe0, 0xb8, 0x14, 0x8b, 0x0d, 0x3f, 0x3c, 0x92, 0xc6, 0xb3, 0x32, 0xee, 0x76, 0x9c, 0x50, 0x9f, 0x43, 0x8e, 0xa0, 0xcc, 0x2f, 0x40, 0x2f, 0x02, 0xbb, 0x8d, 0x92, 0x6a, 0x5e, 0x41, 0xf3, 0x90, 0xd5, 0xcf, 0xef, 0xba, 0x09, 0x5a, 0x30, 0x4f, 0xc3, 0xf0, 0xd0, 0xe3, 0x91, 0xa9, 0x59, 0x82, 0x62, 0x7e, 0xbb, 0xb6, 0x43, 0x8f, 0x31, 0xb8, 0x13, 0x12, 0xf2, 0x3b, 0x5a, 0x81, 0x0f, 0x61, 0x4d, 0xd1, 0x3b, 0x73, 0xe2, 0xfe, 0x56, 0x83, 0x0d, 0x91, 0x64, 0xa7, 0x68, 0x49, 0x82, 0x7d, 0x5b, 0x49, 0xaf, 0x65, 0x66, 0x3e, 0x67, 0xa7, 0xf9, 0xd5, 0xf3, 0xbd, 0x81, 0x33, 0x14, 0x49, 0x2b, 0x28, 0x16, 0x33, 0xee, 0x90, 0xa3, 0x8e, 0xb8, 0xbd, 0x25, 0xcd, 0x5a, 0x1e, 0xde, 0x62, 0x7d, 0x9a, 0x46, 0x54, 0x59, 0x31, 0xc7, 0xb0, 0x99, 0x43, 0x72, 0x2b, 0x81, 0x7b, 0x0a, 0x9b, 0x16, 0x1d, 0x3a, 0xac, 0x1f, 0x4c, 0xb6, 0x4c, 0xbd, 0xe8, 0xec, 0x7e, 0x3f, 0xa4, 0x51, 0x24, 0xd4, 0x26, 0xa4, 0xf9, 0x04, 0x5a, 0x79, 0x31, 0x33, 0x07, 0xe3, 0xc7, 0xb0, 0x71, 0x32, 0x18, 0xb8, 0x8e, 0x47, 0x9f, 0xd3, 0x51, 0x37, 0x83, 0x24, 0xbe, 0x09, 0x24, 0x12, 0xf6, 0x5d, 0xd6, 0x3a, 0xb1, 0x42, 0x96, 0xfb, 0xfd, 0xcc, 0x10, 0x7e, 0x24, 0xd3, 0xe1, 0x98, 0xda, 0xfd, 0x14, 0x42, 0x21, 0x1d, 0x38, 0x9b, 0xa7, 0x03, 0x2a, 0xce, 0xfe, 0x6a, 0x66, 0xc5, 0xbf, 0xd3, 0x00, 0x9e, 0x63, 0x57, 0x7e, 0xe4, 0x0d, 0xfc, 0x52, 0xe7, 0x1b, 0xd0, 0x18, 0xa1, 0x5d, 0x47, 0x1d, 0xfc, 0x65, 0xdd, 0x92, 0x34, 0xab, 0xec, 0xb6, 0xeb, 0xc8, 0x0b, 0x85, 0x13, 0xec, 0x17, 0x01, 0xa5, 0xe1, 0xb9, 0x75, 0xcc, 0xab, 0xdb, 0xa2, 0x25, 0x69, 0x96, 0x8e, 0x3d, 0xd7, 0xa1, 0x5e, 0x8c, 0x5c, 0x7e, 0x89, 0x28, 0x2b, 0x66, 0x17, 0x80, 0x07, 0x72, 0x22, 0x1e, 0x02, 0x75, 0x16, 0xfd, 0x24, 0x04, 0xec, 0x9b, 0xe1, 0x88, 0x62, 0x7b, 0x98, 0xf4, 0x00, 0x9c, 0xc0, 0x72, 0x85, 0xe9, 0x26, 0xd2, 0x5e, 0x50, 0xe6, 0x31, 0x34, 0x59, 0x4b, 0xc4, 0x9d, 0xc6, 0x63, 0x96, 0xb8, 0x46, 0x4b, 0xb3, 0xba, 0xac, 0x4b, 0x4e, 0x74, 0xd7, 0x52, 0xdd, 0xe6, 0xa7, 0x5c, 0x1a, 0xf7, 0xe2, 0x44, 0x69, 0xbb, 0xb0, 0xc0, 0x5f, 0x3f, 0xfc, 0xc2, 0x59, 0x3a, 0x58, 0x65, 0xe1, 0x4c, 0x5d, 0x6f, 0x25, 0xec, 0x44, 0x1e, 0xf7, 0xc2, 0x34, 0x79, 0xfc, 0x10, 0x67, 0xe4, 0xa5, 0xae, 0xb3, 0x12, 0xb6, 0xf9, 0x57, 0x0d, 0x16, 0xb8, 0x98, 0x88, 0x3c, 0x82, 0x79, 0x17, 0xad, 0x46, 0x51, 0x4b, 0x07, 0x1b, 0x98, 0x53, 0x39, 0x5f, 0x7c, 0x52, 0xb1, 0xc4, 0x2e, 0xb6, 0x9f, 0xc3, 0x42, 0x2f, 0x28, 0xfb, 0x55, 0x6b, 0xd9, 0x7e, 0xbe, 0x8b, 0xed, 0xe7, 0x6a, 0xd1, 0x43, 0xca, 0x7e, 0xd5, 0x1a, 0xb6, 0x9f, 0xef, 0x7a, 0xd2, 0x80, 0x79, 0x9e, 0x4b, 0xe6, 0x4b, 0x58, 0x43, 0xb9, 0x99, 0x13, 0xd8, 0xca, 0xc0, 0x6d, 0x48, 0x58, 0xad, 0x0c, 0xac, 0x86, 0x54, 0xdf, 0xca, 0xa8, 0x6f, 0x24, 0x6a, 0x58, 0x7a, 0xb0, 0xf0, 0x25, 0xd9, 0xc8, 0x09, 0x93, 0x02, 0x51, 0x55, 0xce, 0x5c, 0xf6, 0xde, 0x83, 0x05, 0x0e, 0x3e, 0xd3, 0xc5, 0x09, 0x57, 0x5b, 0x09, 0xcf, 0xfc, 0x73, 0x35, 0xad, 0xf5, 0xbd, 0x0b, 0x3a, 0xb2, 0x27, 0xd7, 0x7a, 0x64, 0xa7, 0x8f, 0xb4, 0x42, 0xa7, 0x3b, 0xf1, 0x91, 0x96, 0x69, 0xbf, 0xea, 0x93, 0xda, 0xaf, 0x39, 0xa5, 0xfd, 0xc2, 0xc3, 0x81, 0xfa, 0x44, 0xbb, 0x26, 0x28, 0xb6, 0x7b, 0xe0, 0x8e, 0xa3, 0x0b, 0x6c, 0xd6, 0x1a, 0x16, 0x27, 0x18, 0x1a, 0xd6, 0xfb, 0xea, 0x0d, 0x5c, 0xc4, 0x6f, 0x76, 0x94, 0x07, 0xa1, 0x3f, 0xe2, 0xd7, 0x86, 0xbe, 0xc8, 0x1f, 0xd3, 0xe9, 0x4a, 0xc2, 0x3f, 0xb3, 0xc3, 0x21, 0x8d, 0x75, 0x48, 0xf9, 0x7c, 0x45, 0xbd, 0x79, 0x84, 0x5f, 0x6e, 0xe5, 0xe6, 0xd9, 0x83, 0x8d, 0x67, 0x34, 0x3e, 0x1d, 0x77, 0xd9, 0xdd, 0x7d, 0x38, 0x18, 0x4e, 0xb9, 0x78, 0xcc, 0x73, 0xd8, 0xcc, 0xed, 0x9d, 0x19, 0x22, 0x81, 0x7a, 0x6f, 0x30, 0x4c, 0x02, 0x86, 0xdf, 0x66, 0x07, 0x56, 0x9e, 0xd1, 0x58, 0xd1, 0xfd, 0x40, 0xb9, 0x6a, 0x44, 0x5f, 0x79, 0x38, 0x18, 0x9e, 0xdd, 0x04, 0x74, 0xca, 0xbd, 0x73, 0x0c, 0xab, 0x89, 0x94, 0x99, 0x51, 0x35, 0xa1, 0xd6, 0x1b, 0xc8, 0x8e, 0xb4, 0x37, 0x18, 0x9a, 0x9b, 0xb0, 0xfe, 0x8c, 0x8a, 0x73, 0x9d, 0x22, 0x33, 0x77, 0xd1, 0x5b, 0xca, 0xb2, 0x50, 0x25, 0x04, 0x68, 0xa9, 0x80, 0x3f, 0x6a, 0x40, 0x3e, 0xb1, 0xbd, 0xbe, 0x4b, 0x9f, 0x86, 0xa1, 0x1f, 0x4e, 0x6c, 0xc3, 0x91, 0xfb, 0x56, 0x49, 0xbe, 0x0d, 0x8b, 0x5d, 0xc7, 0x73, 0xfd, 0xe1, 0x67, 0x7e, 0x94, 0xb4, 0x64, 0x72, 0x01, 0x53, 0xf4, 0xa5, 0x2b, 0x1f, 0x77, 0xec, 0xdb, 0x8c, 0x60, 0x3d, 0x03, 0xe9, 0x56, 0x12, 0xec, 0x19, 0x6c, 0x9e, 0x85, 0xb6, 0x17, 0x0d, 0x68, 0x98, 0x6d, 0xee, 0xd2, 0xfb, 0x48, 0x53, 0xef, 0x23, 0xa5, 0x6c, 0x71, 0xcd, 0x82, 0x62, 0xcd, 0x4d, 0x5e, 0xd0, 0xcc, 0x17, 0x7c, 0x5f, 0x0e, 0x6f, 0x32, 0xef, 0x85, 0xfb, 0x4a, 0x54, 0x56, 0x94, 0x67, 0xcc, 0x8b, 0x83, 0xa4, 0xd1, 0x14, 0x48, 0xab, 0x13, 0x90, 0xf2, 0xd0, 0x24, 0x48, 0x63, 0x59, 0xe2, 0x6e, 0xb3, 0xf9, 0xff, 0x0a, 0x5a, 0x38, 0x8e, 0x7b, 0x61, 0xbb, 0x4e, 0x1f, 0x27, 0x85, 0xca, 0x59, 0xc6, 0x91, 0x80, 0xa6, 0x8c, 0x04, 0xd8, 0xc3, 0x86, 0x15, 0x1f, 0x47, 0x1e, 0x23, 0x49, 0x4f, 0x2f, 0xac, 0x2c, 0x2b, 0x95, 0xe6, 0x59, 0xd2, 0xe6, 0x35, 0x6c, 0x15, 0xf4, 0xdf, 0x8a, 0xe1, 0xcf, 0x61, 0xf3, 0x34, 0xf6, 0x83, 0xa2, 0xdd, 0x53, 0x9f, 0x81, 0xd2, 0x8e, 0x6a, 0xce, 0x8e, 0x2b, 0xe6, 0xc7, 0xac, 0xb8, 0xdb, 0x30, 0x63, 0xef, 0x27, 0x70, 0x27, 0x37, 0x64, 0x20, 0x6b, 0xb0, 0x72, 0xe4, 0x5d, 0x31, 0x20, 0x7c, 0xa1, 0x59, 0x21, 0xcb, 0xd0, 0x38, 0xbd, 0x74, 0x02, 0x46, 0x37, 0x35, 0x46, 0x3d, 0xfd, 0x82, 0xf6, 0x90, 0xaa, 0xee, 0x75, 0xa1, 0x91, 0x3c, 0x90, 0xc8, 0x3a, 0xdc, 0x11, 0x3f, 0x4d, 0x96, 0x9a, 0x15, 0x72, 0x07, 0x96, 0x30, 0x44, 0x7c, 0xa9, 0xa9, 0x91, 0x26, 0x2c, 0xf3, 0xb9, 0x9f, 0x58, 0xa9, 0x92, 0x55, 0x00, 0x66, 0xbd, 0xa0, 0x6b, 0x48, 0x5f, 0xf8, 0xd7, 0x82, 0xae, 0xef, 0xfd, 0x14, 0x1a, 0x49, 0xd7, 0xad, 0xe8, 0x48, 0x96, 0x9a, 0x15, 0x86, 0xf9, 0xe9, 0x95, 0xd3, 0x8b, 0xe5, 0x92, 0x46, 0xb6, 0x60, 0xfd, 0xd0, 0xf6, 0x7a, 0xd4, 0xcd, 0x32, 0xaa, 0x7b, 0x1e, 0x2c, 0x88, 0xc2, 0xce, 0xa0, 0x09, 0x59, 0x8c, 0xe4, 0x86, 0xb2, 0x6b, 0x06, 0x29, 0x8d, 0xc1, 0xe0, 0x55, 0x17, 0x69, 0x84, 0xc9, 0xfd, 0x88, 0x34, 0x87, 0x89, 0x10, 0x91, 0xae, 0x93, 0x0d, 0x68, 0xe2, 0xaf, 0xe9, 0x28, 0x70, 0xed, 0x98, 0xaf, 0xce, 0xed, 0x75, 0x60, 0x51, 0x9e, 0x6c, 0xb6, 0x45, 0x68, 0x94, 0x6b, 0xcd, 0x0a, 0xf3, 0x08, 0xba, 0x08, 0xd7, 0x5e, 0x1c, 0x34, 0x35, 0xee, 0x34, 0x3f, 0x48, 0x16, 0xaa, 0x07, 0xff, 0x59, 0x83, 0x79, 0x0e, 0x86, 0x7c, 0x0e, 0x8b, 0x72, 0x04, 0x4e, 0xb0, 0xbd, 0xcb, 0x8f, 0xe4, 0x8d, 0xcd, 0xdc, 0x2a, 0x0f, 0xbb, 0xf9, 0xe0, 0x37, 0x7f, 0xff, 0xf7, 0xd7, 0xd5, 0xbb, 0xe6, 0xc6, 0xbe, 0x1d, 0x38, 0xd1, 0xfe, 0xd5, 0x63, 0xdb, 0x0d, 0x2e, 0xec, 0xc7, 0xfb, 0x2c, 0x0d, 0xa3, 0x0f, 0xb4, 0x3d, 0x32, 0x80, 0x25, 0x65, 0xce, 0x4c, 0x5a, 0x4c, 0x4c, 0x71, 0xb2, 0x6d, 0x6c, 0x15, 0xd6, 0x85, 0x82, 0xf7, 0x51, 0xc1, 0x8e, 0x71, 0xaf, 0x4c, 0xc1, 0xfe, 0x2b, 0x76, 0x67, 0x7e, 0xc9, 0xf4, 0x7c, 0x08, 0x90, 0x8e, 0x7e, 0x09, 0xa2, 0x2d, 0x8c, 0x93, 0x8d, 0x56, 0x7e, 0x59, 0x28, 0xa9, 0x10, 0x17, 0x96, 0x94, 0x19, 0x28, 0x31, 0x72, 0x43, 0x51, 0x65, 0x68, 0x6b, 0xdc, 0x2b, 0xe5, 0x09, 0x49, 0xef, 0x22, 0xdc, 0x36, 0xd9, 0xce, 0xc1, 0x8d, 0x70, 0xab, 0xc0, 0x4b, 0x0e, 0x61, 0x59, 0x1d, 0x35, 0x12, 0xb4, 0xbe, 0x64, 0xc6, 0x6a, 0xe8, 0x45, 0x86, 0x84, 0xfc, 0x31, 0xac, 0x64, 0x0e, 0x1a, 0xd1, 0x0b, 0x03, 0xbe, 0x44, 0xcc, 0xdd, 0x12, 0x8e, 0x94, 0xf3, 0x39, 0xb4, 0x8a, 0xa3, 0x31, 0xf4, 0xe2, 0x7d, 0x25, 0x28, 0xc5, 0xf1, 0x94, 0xd1, 0x9e, 0xc4, 0x96, 0xa2, 0x4f, 0xa0, 0x99, 0x1f, 0x21, 0x11, 0x74, 0xdf, 0x84, 0x89, 0x97, 0xb1, 0x5d, 0xce, 0x94, 0x02, 0x3f, 0x80, 0x45, 0x39, 0xa1, 0xe1, 0x89, 0x9a, 0x1f, 0x14, 0xf1, 0x44, 0x2d, 0x8c, 0x71, 0xcc, 0x0a, 0x19, 0xc2, 0x4a, 0x66, 0x26, 0xc2, 0xfd, 0x55, 0x36, 0xb0, 0xe1, 0xfe, 0x2a, 0x1d, 0xa0, 0x98, 0x0f, 0x31, 0xc0, 0xf7, 0x8c, 0x56, 0x3e, 0xc0, 0xbc, 0xfc, 0xb1, 0x54, 0x3c, 0x82, 0xd5, 0xec, 0xf8, 0x82, 0xdc, 0xe5, 0x97, 0x71, 0xc9, 0x64, 0xc4, 0x30, 0xca, 0x58, 0x12, 0x73, 0x08, 0x2b, 0x99, 0x29, 0x84, 0xc0, 0x5c, 0x32, 0xd8, 0x10, 0x98, 0xcb, 0x46, 0x16, 0xe6, 0x0f, 0x10, 0xf3, 0xfb, 0x7b, 0xef, 0xe6, 0x30, 0x8b, 0xc7, 0xcc, 0xfe, 0x2b, 0xd6, 0x8d, 0x7e, 0x99, 0x24, 0xe7, 0xa5, 0xf4, 0x13, 0x2f, 0x71, 0x19, 0x3f, 0x65, 0x26, 0x19, 0x19, 0x3f, 0x65, 0xa7, 0x15, 0xe6, 0x7b, 0xa8, 0xf3, 0x81, 0x61, 0xe4, 0x74, 0xf2, 0xc7, 0xde, 0xfe, 0x2b, 0x3f, 0xc0, 0x63, 0xfb, 0x4b, 0x80, 0xf4, 0xb9, 0xc6, 0x8f, 0x6d, 0xe1, 0xc5, 0xc8, 0x8f, 0x6d, 0xf1, 0x55, 0x67, 0xb6, 0x51, 0x87, 0x4e, 0x5a, 0xe5, 0x76, 0x91, 0x41, 0x1a, 0x71, 0xfe, 0x0c, 0xca, 0x44, 0x5c, 0x7d, 0xb6, 0x65, 0x23, 0x9e, 0x79, 0xb8, 0x98, 0x3b, 0xa8, 0xc5, 0x30, 0x36, 0xf3, 0x11, 0xc7, 0x6d, 0xcc, 0x08, 0x17, 0x3b, 0xff, 0xf4, 0x41, 0xc1, 0xf5, 0x94, 0xbd, 0x47, 0xb8, 0x9e, 0xd2, 0xd7, 0x47, 0x52, 0xe9, 0x48, 0x3b, 0xaf, 0x67, 0xdc, 0x55, 0x8b, 0x1d, 0x39, 0x83, 0x79, 0xfe, 0x42, 0x20, 0x6b, 0x42, 0x98, 0x22, 0x9f, 0xa8, 0x4b, 0x42, 0xf0, 0x3b, 0x28, 0xf8, 0x3e, 0x99, 0x56, 0x42, 0xc9, 0xaf, 0x61, 0x49, 0x69, 0xaa, 0x79, 0x9d, 0x2e, 0x36, 0xfe, 0xbc, 0x4e, 0x97, 0x74, 0xdf, 0x13, 0xbd, 0x44, 0xd9, 0x2e, 0x3c, 0x16, 0x87, 0xb0, 0xac, 0x3e, 0x3a, 0x78, 0xd1, 0x2b, 0x79, 0x9d, 0x18, 0x7a, 0x91, 0x21, 0x0f, 0xc4, 0x11, 0xac, 0x66, 0xbb, 0x67, 0x7e, 0xb6, 0x4a, 0x5b, 0x73, 0x7e, 0xb6, 0xca, 0x9b, 0x6d, 0xb3, 0xc2, 0xf0, 0xa8, 0xed, 0x2d, 0x51, 0xaf, 0xa0, 0x4c, 0x51, 0xd2, 0x8b, 0x0c, 0x29, 0xe4, 0x18, 0xee, 0xe4, 0xba, 0x45, 0x7e, 0x77, 0x94, 0xb7, 0xb0, 0xfc, 0xee, 0x98, 0xd0, 0x5e, 0x72, 0xeb, 0xb2, 0x3d, 0x1b, 0xb7, 0xae, 0xb4, 0x2d, 0x34, 0x8c, 0x32, 0x96, 0x14, 0xf5, 0x0b, 0x7c, 0xf9, 0xa5, 0x2c, 0x71, 0xb1, 0xb5, 0x85, 0x6f, 0xf3, 0x8c, 0x44, 0xe8, 0x83, 0x89, 0x7c, 0x29, 0xf9, 0x1c, 0x48, 0x66, 0x03, 0x4f, 0x98, 0xfb, 0x85, 0x1f, 0x66, 0xf2, 0xa6, 0x3d, 0x89, 0x2d, 0xc5, 0xda, 0xf2, 0x1a, 0xca, 0x8b, 0x7e, 0xa8, 0xf8, 0x7f, 0x82, 0x78, 0x73, 0xda, 0x96, 0x44, 0xc5, 0x13, 0xfd, 0x6f, 0xaf, 0xdb, 0xda, 0xb7, 0xaf, 0xdb, 0xda, 0xbf, 0x5e, 0xb7, 0xb5, 0x3f, 0xbc, 0x69, 0x57, 0xbe, 0x7d, 0xd3, 0xae, 0xfc, 0xe3, 0x4d, 0xbb, 0xd2, 0x9d, 0xc7, 0xff, 0x22, 0xfc, 0xf0, 0xbf, 0x01, 0x00, 0x00, 0xff, 0xff, 0xf4, 0xe5, 0x6c, 0xa4, 0xcf, 0x20, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. var _ context.Context var _ grpc.ClientConn // This is a compile-time assertion to ensure that this generated file // is compatible with the grpc package it is being compiled against. const _ = grpc.SupportPackageIsVersion4 // MasterClient is the client API for Master service. // // For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. type MasterClient interface { StartTask(ctx context.Context, in *StartTaskRequest, opts ...grpc.CallOption) (*StartTaskResponse, error) OperateTask(ctx context.Context, in *OperateTaskRequest, opts ...grpc.CallOption) (*OperateTaskResponse, error) UpdateTask(ctx context.Context, in *UpdateTaskRequest, opts ...grpc.CallOption) (*UpdateTaskResponse, error) QueryStatus(ctx context.Context, in *QueryStatusListRequest, opts ...grpc.CallOption) (*QueryStatusListResponse, error) // show un-resolved DDL locks ShowDDLLocks(ctx context.Context, in *ShowDDLLocksRequest, opts ...grpc.CallOption) (*ShowDDLLocksResponse, error) // used by dmctl to manually unlock DDL lock UnlockDDLLock(ctx context.Context, in *UnlockDDLLockRequest, opts ...grpc.CallOption) (*UnlockDDLLockResponse, error) // OperateWorkerRelayTask requests some dm-workers to operate relay unit OperateWorkerRelayTask(ctx context.Context, in *OperateWorkerRelayRequest, opts ...grpc.CallOption) (*OperateWorkerRelayResponse, error) // PurgeWorkerRelay purges relay log files for some dm-workers PurgeWorkerRelay(ctx context.Context, in *PurgeWorkerRelayRequest, opts ...grpc.CallOption) (*PurgeWorkerRelayResponse, error) // CheckTask checks legality of task configuration CheckTask(ctx context.Context, in *CheckTaskRequest, opts ...grpc.CallOption) (*CheckTaskResponse, error) // Operate an upstream MySQL source. OperateSource(ctx context.Context, in *OperateSourceRequest, opts ...grpc.CallOption) (*OperateSourceResponse, error) // RegisterWorker register the dm-workers. RegisterWorker(ctx context.Context, in *RegisterWorkerRequest, opts ...grpc.CallOption) (*RegisterWorkerResponse, error) // OfflineMember offline the dm cluster's members (master/worker). OfflineMember(ctx context.Context, in *OfflineMemberRequest, opts ...grpc.CallOption) (*OfflineMemberResponse, error) // OperateLeader do some operate on master: // - evict leader: make the master resign if it is leader, and will not campaign the leader again // - cancel evict leader: the master can campaign leader again. OperateLeader(ctx context.Context, in *OperateLeaderRequest, opts ...grpc.CallOption) (*OperateLeaderResponse, error) // ListMember list member information ListMember(ctx context.Context, in *ListMemberRequest, opts ...grpc.CallOption) (*ListMemberResponse, error) OperateSchema(ctx context.Context, in *OperateSchemaRequest, opts ...grpc.CallOption) (*OperateSchemaResponse, error) GetSubTaskCfg(ctx context.Context, in *GetSubTaskCfgRequest, opts ...grpc.CallOption) (*GetSubTaskCfgResponse, error) // GetCfg get config GetCfg(ctx context.Context, in *GetCfgRequest, opts ...grpc.CallOption) (*GetCfgResponse, error) HandleError(ctx context.Context, in *HandleErrorRequest, opts ...grpc.CallOption) (*HandleErrorResponse, error) GetMasterCfg(ctx context.Context, in *GetMasterCfgRequest, opts ...grpc.CallOption) (*GetMasterCfgResponse, error) TransferSource(ctx context.Context, in *TransferSourceRequest, opts ...grpc.CallOption) (*TransferSourceResponse, error) OperateRelay(ctx context.Context, in *OperateRelayRequest, opts ...grpc.CallOption) (*OperateRelayResponse, error) StartValidation(ctx context.Context, in *StartValidationRequest, opts ...grpc.CallOption) (*StartValidationResponse, error) StopValidation(ctx context.Context, in *StopValidationRequest, opts ...grpc.CallOption) (*StopValidationResponse, error) GetValidationStatus(ctx context.Context, in *GetValidationStatusRequest, opts ...grpc.CallOption) (*GetValidationStatusResponse, error) GetValidationError(ctx context.Context, in *GetValidationErrorRequest, opts ...grpc.CallOption) (*GetValidationErrorResponse, error) OperateValidationError(ctx context.Context, in *OperateValidationErrorRequest, opts ...grpc.CallOption) (*OperateValidationErrorResponse, error) } type masterClient struct { cc *grpc.ClientConn } func NewMasterClient(cc *grpc.ClientConn) MasterClient { return &masterClient{cc} } func (c *masterClient) StartTask(ctx context.Context, in *StartTaskRequest, opts ...grpc.CallOption) (*StartTaskResponse, error) { out := new(StartTaskResponse) err := c.cc.Invoke(ctx, "/pb.Master/StartTask", in, out, opts...) if err != nil { return nil, err } return out, nil } func (c *masterClient) OperateTask(ctx context.Context, in *OperateTaskRequest, opts ...grpc.CallOption) (*OperateTaskResponse, error) { out := new(OperateTaskResponse) err := c.cc.Invoke(ctx, "/pb.Master/OperateTask", in, out, opts...) if err != nil { return nil, err } return out, nil } func (c *masterClient) UpdateTask(ctx context.Context, in *UpdateTaskRequest, opts ...grpc.CallOption) (*UpdateTaskResponse, error) { out := new(UpdateTaskResponse) err := c.cc.Invoke(ctx, "/pb.Master/UpdateTask", in, out, opts...) if err != nil { return nil, err } return out, nil } func (c *masterClient) QueryStatus(ctx context.Context, in *QueryStatusListRequest, opts ...grpc.CallOption) (*QueryStatusListResponse, error) { out := new(QueryStatusListResponse) err := c.cc.Invoke(ctx, "/pb.Master/QueryStatus", in, out, opts...) if err != nil { return nil, err } return out, nil } func (c *masterClient) ShowDDLLocks(ctx context.Context, in *ShowDDLLocksRequest, opts ...grpc.CallOption) (*ShowDDLLocksResponse, error) { out := new(ShowDDLLocksResponse) err := c.cc.Invoke(ctx, "/pb.Master/ShowDDLLocks", in, out, opts...) if err != nil { return nil, err } return out, nil } func (c *masterClient) UnlockDDLLock(ctx context.Context, in *UnlockDDLLockRequest, opts ...grpc.CallOption) (*UnlockDDLLockResponse, error) { out := new(UnlockDDLLockResponse) err := c.cc.Invoke(ctx, "/pb.Master/UnlockDDLLock", in, out, opts...) if err != nil { return nil, err } return out, nil } func (c *masterClient) OperateWorkerRelayTask(ctx context.Context, in *OperateWorkerRelayRequest, opts ...grpc.CallOption) (*OperateWorkerRelayResponse, error) { out := new(OperateWorkerRelayResponse) err := c.cc.Invoke(ctx, "/pb.Master/OperateWorkerRelayTask", in, out, opts...) if err != nil { return nil, err } return out, nil } func (c *masterClient) PurgeWorkerRelay(ctx context.Context, in *PurgeWorkerRelayRequest, opts ...grpc.CallOption) (*PurgeWorkerRelayResponse, error) { out := new(PurgeWorkerRelayResponse) err := c.cc.Invoke(ctx, "/pb.Master/PurgeWorkerRelay", in, out, opts...) if err != nil { return nil, err } return out, nil } func (c *masterClient) CheckTask(ctx context.Context, in *CheckTaskRequest, opts ...grpc.CallOption) (*CheckTaskResponse, error) { out := new(CheckTaskResponse) err := c.cc.Invoke(ctx, "/pb.Master/CheckTask", in, out, opts...) if err != nil { return nil, err } return out, nil } func (c *masterClient) OperateSource(ctx context.Context, in *OperateSourceRequest, opts ...grpc.CallOption) (*OperateSourceResponse, error) { out := new(OperateSourceResponse) err := c.cc.Invoke(ctx, "/pb.Master/OperateSource", in, out, opts...) if err != nil { return nil, err } return out, nil } func (c *masterClient) RegisterWorker(ctx context.Context, in *RegisterWorkerRequest, opts ...grpc.CallOption) (*RegisterWorkerResponse, error) { out := new(RegisterWorkerResponse) err := c.cc.Invoke(ctx, "/pb.Master/RegisterWorker", in, out, opts...) if err != nil { return nil, err } return out, nil } func (c *masterClient) OfflineMember(ctx context.Context, in *OfflineMemberRequest, opts ...grpc.CallOption) (*OfflineMemberResponse, error) { out := new(OfflineMemberResponse) err := c.cc.Invoke(ctx, "/pb.Master/OfflineMember", in, out, opts...) if err != nil { return nil, err } return out, nil } func (c *masterClient) OperateLeader(ctx context.Context, in *OperateLeaderRequest, opts ...grpc.CallOption) (*OperateLeaderResponse, error) { out := new(OperateLeaderResponse) err := c.cc.Invoke(ctx, "/pb.Master/OperateLeader", in, out, opts...) if err != nil { return nil, err } return out, nil } func (c *masterClient) ListMember(ctx context.Context, in *ListMemberRequest, opts ...grpc.CallOption) (*ListMemberResponse, error) { out := new(ListMemberResponse) err := c.cc.Invoke(ctx, "/pb.Master/ListMember", in, out, opts...) if err != nil { return nil, err } return out, nil } func (c *masterClient) OperateSchema(ctx context.Context, in *OperateSchemaRequest, opts ...grpc.CallOption) (*OperateSchemaResponse, error) { out := new(OperateSchemaResponse) err := c.cc.Invoke(ctx, "/pb.Master/OperateSchema", in, out, opts...) if err != nil { return nil, err } return out, nil } func (c *masterClient) GetSubTaskCfg(ctx context.Context, in *GetSubTaskCfgRequest, opts ...grpc.CallOption) (*GetSubTaskCfgResponse, error) { out := new(GetSubTaskCfgResponse) err := c.cc.Invoke(ctx, "/pb.Master/GetSubTaskCfg", in, out, opts...) if err != nil { return nil, err } return out, nil } func (c *masterClient) GetCfg(ctx context.Context, in *GetCfgRequest, opts ...grpc.CallOption) (*GetCfgResponse, error) { out := new(GetCfgResponse) err := c.cc.Invoke(ctx, "/pb.Master/GetCfg", in, out, opts...) if err != nil { return nil, err } return out, nil } func (c *masterClient) HandleError(ctx context.Context, in *HandleErrorRequest, opts ...grpc.CallOption) (*HandleErrorResponse, error) { out := new(HandleErrorResponse) err := c.cc.Invoke(ctx, "/pb.Master/HandleError", in, out, opts...) if err != nil { return nil, err } return out, nil } func (c *masterClient) GetMasterCfg(ctx context.Context, in *GetMasterCfgRequest, opts ...grpc.CallOption) (*GetMasterCfgResponse, error) { out := new(GetMasterCfgResponse) err := c.cc.Invoke(ctx, "/pb.Master/GetMasterCfg", in, out, opts...) if err != nil { return nil, err } return out, nil } func (c *masterClient) TransferSource(ctx context.Context, in *TransferSourceRequest, opts ...grpc.CallOption) (*TransferSourceResponse, error) { out := new(TransferSourceResponse) err := c.cc.Invoke(ctx, "/pb.Master/TransferSource", in, out, opts...) if err != nil { return nil, err } return out, nil } func (c *masterClient) OperateRelay(ctx context.Context, in *OperateRelayRequest, opts ...grpc.CallOption) (*OperateRelayResponse, error) { out := new(OperateRelayResponse) err := c.cc.Invoke(ctx, "/pb.Master/OperateRelay", in, out, opts...) if err != nil { return nil, err } return out, nil } func (c *masterClient) StartValidation(ctx context.Context, in *StartValidationRequest, opts ...grpc.CallOption) (*StartValidationResponse, error) { out := new(StartValidationResponse) err := c.cc.Invoke(ctx, "/pb.Master/StartValidation", in, out, opts...) if err != nil { return nil, err } return out, nil } func (c *masterClient) StopValidation(ctx context.Context, in *StopValidationRequest, opts ...grpc.CallOption) (*StopValidationResponse, error) { out := new(StopValidationResponse) err := c.cc.Invoke(ctx, "/pb.Master/StopValidation", in, out, opts...) if err != nil { return nil, err } return out, nil } func (c *masterClient) GetValidationStatus(ctx context.Context, in *GetValidationStatusRequest, opts ...grpc.CallOption) (*GetValidationStatusResponse, error) { out := new(GetValidationStatusResponse) err := c.cc.Invoke(ctx, "/pb.Master/GetValidationStatus", in, out, opts...) if err != nil { return nil, err } return out, nil } func (c *masterClient) GetValidationError(ctx context.Context, in *GetValidationErrorRequest, opts ...grpc.CallOption) (*GetValidationErrorResponse, error) { out := new(GetValidationErrorResponse) err := c.cc.Invoke(ctx, "/pb.Master/GetValidationError", in, out, opts...) if err != nil { return nil, err } return out, nil } func (c *masterClient) OperateValidationError(ctx context.Context, in *OperateValidationErrorRequest, opts ...grpc.CallOption) (*OperateValidationErrorResponse, error) { out := new(OperateValidationErrorResponse) err := c.cc.Invoke(ctx, "/pb.Master/OperateValidationError", in, out, opts...) if err != nil { return nil, err } return out, nil } // MasterServer is the server API for Master service. type MasterServer interface { StartTask(context.Context, *StartTaskRequest) (*StartTaskResponse, error) OperateTask(context.Context, *OperateTaskRequest) (*OperateTaskResponse, error) UpdateTask(context.Context, *UpdateTaskRequest) (*UpdateTaskResponse, error) QueryStatus(context.Context, *QueryStatusListRequest) (*QueryStatusListResponse, error) // show un-resolved DDL locks ShowDDLLocks(context.Context, *ShowDDLLocksRequest) (*ShowDDLLocksResponse, error) // used by dmctl to manually unlock DDL lock UnlockDDLLock(context.Context, *UnlockDDLLockRequest) (*UnlockDDLLockResponse, error) // OperateWorkerRelayTask requests some dm-workers to operate relay unit OperateWorkerRelayTask(context.Context, *OperateWorkerRelayRequest) (*OperateWorkerRelayResponse, error) // PurgeWorkerRelay purges relay log files for some dm-workers PurgeWorkerRelay(context.Context, *PurgeWorkerRelayRequest) (*PurgeWorkerRelayResponse, error) // CheckTask checks legality of task configuration CheckTask(context.Context, *CheckTaskRequest) (*CheckTaskResponse, error) // Operate an upstream MySQL source. OperateSource(context.Context, *OperateSourceRequest) (*OperateSourceResponse, error) // RegisterWorker register the dm-workers. RegisterWorker(context.Context, *RegisterWorkerRequest) (*RegisterWorkerResponse, error) // OfflineMember offline the dm cluster's members (master/worker). OfflineMember(context.Context, *OfflineMemberRequest) (*OfflineMemberResponse, error) // OperateLeader do some operate on master: // - evict leader: make the master resign if it is leader, and will not campaign the leader again // - cancel evict leader: the master can campaign leader again. OperateLeader(context.Context, *OperateLeaderRequest) (*OperateLeaderResponse, error) // ListMember list member information ListMember(context.Context, *ListMemberRequest) (*ListMemberResponse, error) OperateSchema(context.Context, *OperateSchemaRequest) (*OperateSchemaResponse, error) GetSubTaskCfg(context.Context, *GetSubTaskCfgRequest) (*GetSubTaskCfgResponse, error) // GetCfg get config GetCfg(context.Context, *GetCfgRequest) (*GetCfgResponse, error) HandleError(context.Context, *HandleErrorRequest) (*HandleErrorResponse, error) GetMasterCfg(context.Context, *GetMasterCfgRequest) (*GetMasterCfgResponse, error) TransferSource(context.Context, *TransferSourceRequest) (*TransferSourceResponse, error) OperateRelay(context.Context, *OperateRelayRequest) (*OperateRelayResponse, error) StartValidation(context.Context, *StartValidationRequest) (*StartValidationResponse, error) StopValidation(context.Context, *StopValidationRequest) (*StopValidationResponse, error) GetValidationStatus(context.Context, *GetValidationStatusRequest) (*GetValidationStatusResponse, error) GetValidationError(context.Context, *GetValidationErrorRequest) (*GetValidationErrorResponse, error) OperateValidationError(context.Context, *OperateValidationErrorRequest) (*OperateValidationErrorResponse, error) } // UnimplementedMasterServer can be embedded to have forward compatible implementations. type UnimplementedMasterServer struct { } func (*UnimplementedMasterServer) StartTask(ctx context.Context, req *StartTaskRequest) (*StartTaskResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method StartTask not implemented") } func (*UnimplementedMasterServer) OperateTask(ctx context.Context, req *OperateTaskRequest) (*OperateTaskResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method OperateTask not implemented") } func (*UnimplementedMasterServer) UpdateTask(ctx context.Context, req *UpdateTaskRequest) (*UpdateTaskResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method UpdateTask not implemented") } func (*UnimplementedMasterServer) QueryStatus(ctx context.Context, req *QueryStatusListRequest) (*QueryStatusListResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method QueryStatus not implemented") } func (*UnimplementedMasterServer) ShowDDLLocks(ctx context.Context, req *ShowDDLLocksRequest) (*ShowDDLLocksResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method ShowDDLLocks not implemented") } func (*UnimplementedMasterServer) UnlockDDLLock(ctx context.Context, req *UnlockDDLLockRequest) (*UnlockDDLLockResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method UnlockDDLLock not implemented") } func (*UnimplementedMasterServer) OperateWorkerRelayTask(ctx context.Context, req *OperateWorkerRelayRequest) (*OperateWorkerRelayResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method OperateWorkerRelayTask not implemented") } func (*UnimplementedMasterServer) PurgeWorkerRelay(ctx context.Context, req *PurgeWorkerRelayRequest) (*PurgeWorkerRelayResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method PurgeWorkerRelay not implemented") } func (*UnimplementedMasterServer) CheckTask(ctx context.Context, req *CheckTaskRequest) (*CheckTaskResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method CheckTask not implemented") } func (*UnimplementedMasterServer) OperateSource(ctx context.Context, req *OperateSourceRequest) (*OperateSourceResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method OperateSource not implemented") } func (*UnimplementedMasterServer) RegisterWorker(ctx context.Context, req *RegisterWorkerRequest) (*RegisterWorkerResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method RegisterWorker not implemented") } func (*UnimplementedMasterServer) OfflineMember(ctx context.Context, req *OfflineMemberRequest) (*OfflineMemberResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method OfflineMember not implemented") } func (*UnimplementedMasterServer) OperateLeader(ctx context.Context, req *OperateLeaderRequest) (*OperateLeaderResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method OperateLeader not implemented") } func (*UnimplementedMasterServer) ListMember(ctx context.Context, req *ListMemberRequest) (*ListMemberResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method ListMember not implemented") } func (*UnimplementedMasterServer) OperateSchema(ctx context.Context, req *OperateSchemaRequest) (*OperateSchemaResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method OperateSchema not implemented") } func (*UnimplementedMasterServer) GetSubTaskCfg(ctx context.Context, req *GetSubTaskCfgRequest) (*GetSubTaskCfgResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method GetSubTaskCfg not implemented") } func (*UnimplementedMasterServer) GetCfg(ctx context.Context, req *GetCfgRequest) (*GetCfgResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method GetCfg not implemented") } func (*UnimplementedMasterServer) HandleError(ctx context.Context, req *HandleErrorRequest) (*HandleErrorResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method HandleError not implemented") } func (*UnimplementedMasterServer) GetMasterCfg(ctx context.Context, req *GetMasterCfgRequest) (*GetMasterCfgResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method GetMasterCfg not implemented") } func (*UnimplementedMasterServer) TransferSource(ctx context.Context, req *TransferSourceRequest) (*TransferSourceResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method TransferSource not implemented") } func (*UnimplementedMasterServer) OperateRelay(ctx context.Context, req *OperateRelayRequest) (*OperateRelayResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method OperateRelay not implemented") } func (*UnimplementedMasterServer) StartValidation(ctx context.Context, req *StartValidationRequest) (*StartValidationResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method StartValidation not implemented") } func (*UnimplementedMasterServer) StopValidation(ctx context.Context, req *StopValidationRequest) (*StopValidationResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method StopValidation not implemented") } func (*UnimplementedMasterServer) GetValidationStatus(ctx context.Context, req *GetValidationStatusRequest) (*GetValidationStatusResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method GetValidationStatus not implemented") } func (*UnimplementedMasterServer) GetValidationError(ctx context.Context, req *GetValidationErrorRequest) (*GetValidationErrorResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method GetValidationError not implemented") } func (*UnimplementedMasterServer) OperateValidationError(ctx context.Context, req *OperateValidationErrorRequest) (*OperateValidationErrorResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method OperateValidationError not implemented") } func RegisterMasterServer(s *grpc.Server, srv MasterServer) { s.RegisterService(&_Master_serviceDesc, srv) } func _Master_StartTask_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { in := new(StartTaskRequest) if err := dec(in); err != nil { return nil, err } if interceptor == nil { return srv.(MasterServer).StartTask(ctx, in) } info := &grpc.UnaryServerInfo{ Server: srv, FullMethod: "/pb.Master/StartTask", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(MasterServer).StartTask(ctx, req.(*StartTaskRequest)) } return interceptor(ctx, in, info, handler) } func _Master_OperateTask_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { in := new(OperateTaskRequest) if err := dec(in); err != nil { return nil, err } if interceptor == nil { return srv.(MasterServer).OperateTask(ctx, in) } info := &grpc.UnaryServerInfo{ Server: srv, FullMethod: "/pb.Master/OperateTask", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(MasterServer).OperateTask(ctx, req.(*OperateTaskRequest)) } return interceptor(ctx, in, info, handler) } func _Master_UpdateTask_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { in := new(UpdateTaskRequest) if err := dec(in); err != nil { return nil, err } if interceptor == nil { return srv.(MasterServer).UpdateTask(ctx, in) } info := &grpc.UnaryServerInfo{ Server: srv, FullMethod: "/pb.Master/UpdateTask", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(MasterServer).UpdateTask(ctx, req.(*UpdateTaskRequest)) } return interceptor(ctx, in, info, handler) } func _Master_QueryStatus_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { in := new(QueryStatusListRequest) if err := dec(in); err != nil { return nil, err } if interceptor == nil { return srv.(MasterServer).QueryStatus(ctx, in) } info := &grpc.UnaryServerInfo{ Server: srv, FullMethod: "/pb.Master/QueryStatus", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(MasterServer).QueryStatus(ctx, req.(*QueryStatusListRequest)) } return interceptor(ctx, in, info, handler) } func _Master_ShowDDLLocks_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { in := new(ShowDDLLocksRequest) if err := dec(in); err != nil { return nil, err } if interceptor == nil { return srv.(MasterServer).ShowDDLLocks(ctx, in) } info := &grpc.UnaryServerInfo{ Server: srv, FullMethod: "/pb.Master/ShowDDLLocks", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(MasterServer).ShowDDLLocks(ctx, req.(*ShowDDLLocksRequest)) } return interceptor(ctx, in, info, handler) } func _Master_UnlockDDLLock_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { in := new(UnlockDDLLockRequest) if err := dec(in); err != nil { return nil, err } if interceptor == nil { return srv.(MasterServer).UnlockDDLLock(ctx, in) } info := &grpc.UnaryServerInfo{ Server: srv, FullMethod: "/pb.Master/UnlockDDLLock", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(MasterServer).UnlockDDLLock(ctx, req.(*UnlockDDLLockRequest)) } return interceptor(ctx, in, info, handler) } func _Master_OperateWorkerRelayTask_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { in := new(OperateWorkerRelayRequest) if err := dec(in); err != nil { return nil, err } if interceptor == nil { return srv.(MasterServer).OperateWorkerRelayTask(ctx, in) } info := &grpc.UnaryServerInfo{ Server: srv, FullMethod: "/pb.Master/OperateWorkerRelayTask", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(MasterServer).OperateWorkerRelayTask(ctx, req.(*OperateWorkerRelayRequest)) } return interceptor(ctx, in, info, handler) } func _Master_PurgeWorkerRelay_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { in := new(PurgeWorkerRelayRequest) if err := dec(in); err != nil { return nil, err } if interceptor == nil { return srv.(MasterServer).PurgeWorkerRelay(ctx, in) } info := &grpc.UnaryServerInfo{ Server: srv, FullMethod: "/pb.Master/PurgeWorkerRelay", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(MasterServer).PurgeWorkerRelay(ctx, req.(*PurgeWorkerRelayRequest)) } return interceptor(ctx, in, info, handler) } func _Master_CheckTask_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { in := new(CheckTaskRequest) if err := dec(in); err != nil { return nil, err } if interceptor == nil { return srv.(MasterServer).CheckTask(ctx, in) } info := &grpc.UnaryServerInfo{ Server: srv, FullMethod: "/pb.Master/CheckTask", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(MasterServer).CheckTask(ctx, req.(*CheckTaskRequest)) } return interceptor(ctx, in, info, handler) } func _Master_OperateSource_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { in := new(OperateSourceRequest) if err := dec(in); err != nil { return nil, err } if interceptor == nil { return srv.(MasterServer).OperateSource(ctx, in) } info := &grpc.UnaryServerInfo{ Server: srv, FullMethod: "/pb.Master/OperateSource", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(MasterServer).OperateSource(ctx, req.(*OperateSourceRequest)) } return interceptor(ctx, in, info, handler) } func _Master_RegisterWorker_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { in := new(RegisterWorkerRequest) if err := dec(in); err != nil { return nil, err } if interceptor == nil { return srv.(MasterServer).RegisterWorker(ctx, in) } info := &grpc.UnaryServerInfo{ Server: srv, FullMethod: "/pb.Master/RegisterWorker", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(MasterServer).RegisterWorker(ctx, req.(*RegisterWorkerRequest)) } return interceptor(ctx, in, info, handler) } func _Master_OfflineMember_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { in := new(OfflineMemberRequest) if err := dec(in); err != nil { return nil, err } if interceptor == nil { return srv.(MasterServer).OfflineMember(ctx, in) } info := &grpc.UnaryServerInfo{ Server: srv, FullMethod: "/pb.Master/OfflineMember", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(MasterServer).OfflineMember(ctx, req.(*OfflineMemberRequest)) } return interceptor(ctx, in, info, handler) } func _Master_OperateLeader_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { in := new(OperateLeaderRequest) if err := dec(in); err != nil { return nil, err } if interceptor == nil { return srv.(MasterServer).OperateLeader(ctx, in) } info := &grpc.UnaryServerInfo{ Server: srv, FullMethod: "/pb.Master/OperateLeader", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(MasterServer).OperateLeader(ctx, req.(*OperateLeaderRequest)) } return interceptor(ctx, in, info, handler) } func _Master_ListMember_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { in := new(ListMemberRequest) if err := dec(in); err != nil { return nil, err } if interceptor == nil { return srv.(MasterServer).ListMember(ctx, in) } info := &grpc.UnaryServerInfo{ Server: srv, FullMethod: "/pb.Master/ListMember", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(MasterServer).ListMember(ctx, req.(*ListMemberRequest)) } return interceptor(ctx, in, info, handler) } func _Master_OperateSchema_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { in := new(OperateSchemaRequest) if err := dec(in); err != nil { return nil, err } if interceptor == nil { return srv.(MasterServer).OperateSchema(ctx, in) } info := &grpc.UnaryServerInfo{ Server: srv, FullMethod: "/pb.Master/OperateSchema", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(MasterServer).OperateSchema(ctx, req.(*OperateSchemaRequest)) } return interceptor(ctx, in, info, handler) } func _Master_GetSubTaskCfg_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { in := new(GetSubTaskCfgRequest) if err := dec(in); err != nil { return nil, err } if interceptor == nil { return srv.(MasterServer).GetSubTaskCfg(ctx, in) } info := &grpc.UnaryServerInfo{ Server: srv, FullMethod: "/pb.Master/GetSubTaskCfg", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(MasterServer).GetSubTaskCfg(ctx, req.(*GetSubTaskCfgRequest)) } return interceptor(ctx, in, info, handler) } func _Master_GetCfg_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { in := new(GetCfgRequest) if err := dec(in); err != nil { return nil, err } if interceptor == nil { return srv.(MasterServer).GetCfg(ctx, in) } info := &grpc.UnaryServerInfo{ Server: srv, FullMethod: "/pb.Master/GetCfg", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(MasterServer).GetCfg(ctx, req.(*GetCfgRequest)) } return interceptor(ctx, in, info, handler) } func _Master_HandleError_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { in := new(HandleErrorRequest) if err := dec(in); err != nil { return nil, err } if interceptor == nil { return srv.(MasterServer).HandleError(ctx, in) } info := &grpc.UnaryServerInfo{ Server: srv, FullMethod: "/pb.Master/HandleError", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(MasterServer).HandleError(ctx, req.(*HandleErrorRequest)) } return interceptor(ctx, in, info, handler) } func _Master_GetMasterCfg_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { in := new(GetMasterCfgRequest) if err := dec(in); err != nil { return nil, err } if interceptor == nil { return srv.(MasterServer).GetMasterCfg(ctx, in) } info := &grpc.UnaryServerInfo{ Server: srv, FullMethod: "/pb.Master/GetMasterCfg", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(MasterServer).GetMasterCfg(ctx, req.(*GetMasterCfgRequest)) } return interceptor(ctx, in, info, handler) } func _Master_TransferSource_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { in := new(TransferSourceRequest) if err := dec(in); err != nil { return nil, err } if interceptor == nil { return srv.(MasterServer).TransferSource(ctx, in) } info := &grpc.UnaryServerInfo{ Server: srv, FullMethod: "/pb.Master/TransferSource", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(MasterServer).TransferSource(ctx, req.(*TransferSourceRequest)) } return interceptor(ctx, in, info, handler) } func _Master_OperateRelay_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { in := new(OperateRelayRequest) if err := dec(in); err != nil { return nil, err } if interceptor == nil { return srv.(MasterServer).OperateRelay(ctx, in) } info := &grpc.UnaryServerInfo{ Server: srv, FullMethod: "/pb.Master/OperateRelay", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(MasterServer).OperateRelay(ctx, req.(*OperateRelayRequest)) } return interceptor(ctx, in, info, handler) } func _Master_StartValidation_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { in := new(StartValidationRequest) if err := dec(in); err != nil { return nil, err } if interceptor == nil { return srv.(MasterServer).StartValidation(ctx, in) } info := &grpc.UnaryServerInfo{ Server: srv, FullMethod: "/pb.Master/StartValidation", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(MasterServer).StartValidation(ctx, req.(*StartValidationRequest)) } return interceptor(ctx, in, info, handler) } func _Master_StopValidation_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { in := new(StopValidationRequest) if err := dec(in); err != nil { return nil, err } if interceptor == nil { return srv.(MasterServer).StopValidation(ctx, in) } info := &grpc.UnaryServerInfo{ Server: srv, FullMethod: "/pb.Master/StopValidation", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(MasterServer).StopValidation(ctx, req.(*StopValidationRequest)) } return interceptor(ctx, in, info, handler) } func _Master_GetValidationStatus_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { in := new(GetValidationStatusRequest) if err := dec(in); err != nil { return nil, err } if interceptor == nil { return srv.(MasterServer).GetValidationStatus(ctx, in) } info := &grpc.UnaryServerInfo{ Server: srv, FullMethod: "/pb.Master/GetValidationStatus", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(MasterServer).GetValidationStatus(ctx, req.(*GetValidationStatusRequest)) } return interceptor(ctx, in, info, handler) } func _Master_GetValidationError_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { in := new(GetValidationErrorRequest) if err := dec(in); err != nil { return nil, err } if interceptor == nil { return srv.(MasterServer).GetValidationError(ctx, in) } info := &grpc.UnaryServerInfo{ Server: srv, FullMethod: "/pb.Master/GetValidationError", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(MasterServer).GetValidationError(ctx, req.(*GetValidationErrorRequest)) } return interceptor(ctx, in, info, handler) } func _Master_OperateValidationError_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { in := new(OperateValidationErrorRequest) if err := dec(in); err != nil { return nil, err } if interceptor == nil { return srv.(MasterServer).OperateValidationError(ctx, in) } info := &grpc.UnaryServerInfo{ Server: srv, FullMethod: "/pb.Master/OperateValidationError", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(MasterServer).OperateValidationError(ctx, req.(*OperateValidationErrorRequest)) } return interceptor(ctx, in, info, handler) } var _Master_serviceDesc = grpc.ServiceDesc{ ServiceName: "pb.Master", HandlerType: (*MasterServer)(nil), Methods: []grpc.MethodDesc{ { MethodName: "StartTask", Handler: _Master_StartTask_Handler, }, { MethodName: "OperateTask", Handler: _Master_OperateTask_Handler, }, { MethodName: "UpdateTask", Handler: _Master_UpdateTask_Handler, }, { MethodName: "QueryStatus", Handler: _Master_QueryStatus_Handler, }, { MethodName: "ShowDDLLocks", Handler: _Master_ShowDDLLocks_Handler, }, { MethodName: "UnlockDDLLock", Handler: _Master_UnlockDDLLock_Handler, }, { MethodName: "OperateWorkerRelayTask", Handler: _Master_OperateWorkerRelayTask_Handler, }, { MethodName: "PurgeWorkerRelay", Handler: _Master_PurgeWorkerRelay_Handler, }, { MethodName: "CheckTask", Handler: _Master_CheckTask_Handler, }, { MethodName: "OperateSource", Handler: _Master_OperateSource_Handler, }, { MethodName: "RegisterWorker", Handler: _Master_RegisterWorker_Handler, }, { MethodName: "OfflineMember", Handler: _Master_OfflineMember_Handler, }, { MethodName: "OperateLeader", Handler: _Master_OperateLeader_Handler, }, { MethodName: "ListMember", Handler: _Master_ListMember_Handler, }, { MethodName: "OperateSchema", Handler: _Master_OperateSchema_Handler, }, { MethodName: "GetSubTaskCfg", Handler: _Master_GetSubTaskCfg_Handler, }, { MethodName: "GetCfg", Handler: _Master_GetCfg_Handler, }, { MethodName: "HandleError", Handler: _Master_HandleError_Handler, }, { MethodName: "GetMasterCfg", Handler: _Master_GetMasterCfg_Handler, }, { MethodName: "TransferSource", Handler: _Master_TransferSource_Handler, }, { MethodName: "OperateRelay", Handler: _Master_OperateRelay_Handler, }, { MethodName: "StartValidation", Handler: _Master_StartValidation_Handler, }, { MethodName: "StopValidation", Handler: _Master_StopValidation_Handler, }, { MethodName: "GetValidationStatus", Handler: _Master_GetValidationStatus_Handler, }, { MethodName: "GetValidationError", Handler: _Master_GetValidationError_Handler, }, { MethodName: "OperateValidationError", Handler: _Master_OperateValidationError_Handler, }, }, Streams: []grpc.StreamDesc{}, Metadata: "dmmaster.proto", } func (m *StartTaskRequest) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) if err != nil { return nil, err } return dAtA[:n], nil } func (m *StartTaskRequest) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } func (m *StartTaskRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int _ = l if len(m.StartTime) > 0 { i -= len(m.StartTime) copy(dAtA[i:], m.StartTime) i = encodeVarintDmmaster(dAtA, i, uint64(len(m.StartTime))) i-- dAtA[i] = 0x22 } if m.RemoveMeta { i-- if m.RemoveMeta { dAtA[i] = 1 } else { dAtA[i] = 0 } i-- dAtA[i] = 0x18 } if len(m.Sources) > 0 { for iNdEx := len(m.Sources) - 1; iNdEx >= 0; iNdEx-- { i -= len(m.Sources[iNdEx]) copy(dAtA[i:], m.Sources[iNdEx]) i = encodeVarintDmmaster(dAtA, i, uint64(len(m.Sources[iNdEx]))) i-- dAtA[i] = 0x12 } } if len(m.Task) > 0 { i -= len(m.Task) copy(dAtA[i:], m.Task) i = encodeVarintDmmaster(dAtA, i, uint64(len(m.Task))) i-- dAtA[i] = 0xa } return len(dAtA) - i, nil } func (m *StartTaskResponse) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) if err != nil { return nil, err } return dAtA[:n], nil } func (m *StartTaskResponse) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } func (m *StartTaskResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int _ = l if len(m.CheckResult) > 0 { i -= len(m.CheckResult) copy(dAtA[i:], m.CheckResult) i = encodeVarintDmmaster(dAtA, i, uint64(len(m.CheckResult))) i-- dAtA[i] = 0x22 } if len(m.Sources) > 0 { for iNdEx := len(m.Sources) - 1; iNdEx >= 0; iNdEx-- { { size, err := m.Sources[iNdEx].MarshalToSizedBuffer(dAtA[:i]) if err != nil { return 0, err } i -= size i = encodeVarintDmmaster(dAtA, i, uint64(size)) } i-- dAtA[i] = 0x1a } } if len(m.Msg) > 0 { i -= len(m.Msg) copy(dAtA[i:], m.Msg) i = encodeVarintDmmaster(dAtA, i, uint64(len(m.Msg))) i-- dAtA[i] = 0x12 } if m.Result { i-- if m.Result { dAtA[i] = 1 } else { dAtA[i] = 0 } i-- dAtA[i] = 0x8 } return len(dAtA) - i, nil } func (m *OperateTaskRequest) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) if err != nil { return nil, err } return dAtA[:n], nil } func (m *OperateTaskRequest) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } func (m *OperateTaskRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int _ = l if len(m.Sources) > 0 { for iNdEx := len(m.Sources) - 1; iNdEx >= 0; iNdEx-- { i -= len(m.Sources[iNdEx]) copy(dAtA[i:], m.Sources[iNdEx]) i = encodeVarintDmmaster(dAtA, i, uint64(len(m.Sources[iNdEx]))) i-- dAtA[i] = 0x1a } } if len(m.Name) > 0 { i -= len(m.Name) copy(dAtA[i:], m.Name) i = encodeVarintDmmaster(dAtA, i, uint64(len(m.Name))) i-- dAtA[i] = 0x12 } if m.Op != 0 { i = encodeVarintDmmaster(dAtA, i, uint64(m.Op)) i-- dAtA[i] = 0x8 } return len(dAtA) - i, nil } func (m *OperateTaskResponse) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) if err != nil { return nil, err } return dAtA[:n], nil } func (m *OperateTaskResponse) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } func (m *OperateTaskResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int _ = l if len(m.Sources) > 0 { for iNdEx := len(m.Sources) - 1; iNdEx >= 0; iNdEx-- { { size, err := m.Sources[iNdEx].MarshalToSizedBuffer(dAtA[:i]) if err != nil { return 0, err } i -= size i = encodeVarintDmmaster(dAtA, i, uint64(size)) } i-- dAtA[i] = 0x22 } } if len(m.Msg) > 0 { i -= len(m.Msg) copy(dAtA[i:], m.Msg) i = encodeVarintDmmaster(dAtA, i, uint64(len(m.Msg))) i-- dAtA[i] = 0x1a } if m.Result { i-- if m.Result { dAtA[i] = 1 } else { dAtA[i] = 0 } i-- dAtA[i] = 0x10 } if m.Op != 0 { i = encodeVarintDmmaster(dAtA, i, uint64(m.Op)) i-- dAtA[i] = 0x8 } return len(dAtA) - i, nil } func (m *UpdateTaskRequest) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) if err != nil { return nil, err } return dAtA[:n], nil } func (m *UpdateTaskRequest) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } func (m *UpdateTaskRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int _ = l if len(m.Sources) > 0 { for iNdEx := len(m.Sources) - 1; iNdEx >= 0; iNdEx-- { i -= len(m.Sources[iNdEx]) copy(dAtA[i:], m.Sources[iNdEx]) i = encodeVarintDmmaster(dAtA, i, uint64(len(m.Sources[iNdEx]))) i-- dAtA[i] = 0x12 } } if len(m.Task) > 0 { i -= len(m.Task) copy(dAtA[i:], m.Task) i = encodeVarintDmmaster(dAtA, i, uint64(len(m.Task))) i-- dAtA[i] = 0xa } return len(dAtA) - i, nil } func (m *UpdateTaskResponse) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) if err != nil { return nil, err } return dAtA[:n], nil } func (m *UpdateTaskResponse) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } func (m *UpdateTaskResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int _ = l if len(m.CheckResult) > 0 { i -= len(m.CheckResult) copy(dAtA[i:], m.CheckResult) i = encodeVarintDmmaster(dAtA, i, uint64(len(m.CheckResult))) i-- dAtA[i] = 0x22 } if len(m.Sources) > 0 { for iNdEx := len(m.Sources) - 1; iNdEx >= 0; iNdEx-- { { size, err := m.Sources[iNdEx].MarshalToSizedBuffer(dAtA[:i]) if err != nil { return 0, err } i -= size i = encodeVarintDmmaster(dAtA, i, uint64(size)) } i-- dAtA[i] = 0x1a } } if len(m.Msg) > 0 { i -= len(m.Msg) copy(dAtA[i:], m.Msg) i = encodeVarintDmmaster(dAtA, i, uint64(len(m.Msg))) i-- dAtA[i] = 0x12 } if m.Result { i-- if m.Result { dAtA[i] = 1 } else { dAtA[i] = 0 } i-- dAtA[i] = 0x8 } return len(dAtA) - i, nil } func (m *QueryStatusListRequest) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) if err != nil { return nil, err } return dAtA[:n], nil } func (m *QueryStatusListRequest) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } func (m *QueryStatusListRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int _ = l if len(m.Sources) > 0 { for iNdEx := len(m.Sources) - 1; iNdEx >= 0; iNdEx-- { i -= len(m.Sources[iNdEx]) copy(dAtA[i:], m.Sources[iNdEx]) i = encodeVarintDmmaster(dAtA, i, uint64(len(m.Sources[iNdEx]))) i-- dAtA[i] = 0x12 } } if len(m.Name) > 0 { i -= len(m.Name) copy(dAtA[i:], m.Name) i = encodeVarintDmmaster(dAtA, i, uint64(len(m.Name))) i-- dAtA[i] = 0xa } return len(dAtA) - i, nil } func (m *QueryStatusListResponse) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) if err != nil { return nil, err } return dAtA[:n], nil } func (m *QueryStatusListResponse) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } func (m *QueryStatusListResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int _ = l if len(m.Sources) > 0 { for iNdEx := len(m.Sources) - 1; iNdEx >= 0; iNdEx-- { { size, err := m.Sources[iNdEx].MarshalToSizedBuffer(dAtA[:i]) if err != nil { return 0, err } i -= size i = encodeVarintDmmaster(dAtA, i, uint64(size)) } i-- dAtA[i] = 0x1a } } if len(m.Msg) > 0 { i -= len(m.Msg) copy(dAtA[i:], m.Msg) i = encodeVarintDmmaster(dAtA, i, uint64(len(m.Msg))) i-- dAtA[i] = 0x12 } if m.Result { i-- if m.Result { dAtA[i] = 1 } else { dAtA[i] = 0 } i-- dAtA[i] = 0x8 } return len(dAtA) - i, nil } func (m *ShowDDLLocksRequest) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) if err != nil { return nil, err } return dAtA[:n], nil } func (m *ShowDDLLocksRequest) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } func (m *ShowDDLLocksRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int _ = l if len(m.Sources) > 0 { for iNdEx := len(m.Sources) - 1; iNdEx >= 0; iNdEx-- { i -= len(m.Sources[iNdEx]) copy(dAtA[i:], m.Sources[iNdEx]) i = encodeVarintDmmaster(dAtA, i, uint64(len(m.Sources[iNdEx]))) i-- dAtA[i] = 0x12 } } if len(m.Task) > 0 { i -= len(m.Task) copy(dAtA[i:], m.Task) i = encodeVarintDmmaster(dAtA, i, uint64(len(m.Task))) i-- dAtA[i] = 0xa } return len(dAtA) - i, nil } func (m *DDLLock) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) if err != nil { return nil, err } return dAtA[:n], nil } func (m *DDLLock) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } func (m *DDLLock) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int _ = l if len(m.Unsynced) > 0 { for iNdEx := len(m.Unsynced) - 1; iNdEx >= 0; iNdEx-- { i -= len(m.Unsynced[iNdEx]) copy(dAtA[i:], m.Unsynced[iNdEx]) i = encodeVarintDmmaster(dAtA, i, uint64(len(m.Unsynced[iNdEx]))) i-- dAtA[i] = 0x3a } } if len(m.Synced) > 0 { for iNdEx := len(m.Synced) - 1; iNdEx >= 0; iNdEx-- { i -= len(m.Synced[iNdEx]) copy(dAtA[i:], m.Synced[iNdEx]) i = encodeVarintDmmaster(dAtA, i, uint64(len(m.Synced[iNdEx]))) i-- dAtA[i] = 0x32 } } if len(m.DDLs) > 0 { for iNdEx := len(m.DDLs) - 1; iNdEx >= 0; iNdEx-- { i -= len(m.DDLs[iNdEx]) copy(dAtA[i:], m.DDLs[iNdEx]) i = encodeVarintDmmaster(dAtA, i, uint64(len(m.DDLs[iNdEx]))) i-- dAtA[i] = 0x2a } } if len(m.Owner) > 0 { i -= len(m.Owner) copy(dAtA[i:], m.Owner) i = encodeVarintDmmaster(dAtA, i, uint64(len(m.Owner))) i-- dAtA[i] = 0x22 } if len(m.Mode) > 0 { i -= len(m.Mode) copy(dAtA[i:], m.Mode) i = encodeVarintDmmaster(dAtA, i, uint64(len(m.Mode))) i-- dAtA[i] = 0x1a } if len(m.Task) > 0 { i -= len(m.Task) copy(dAtA[i:], m.Task) i = encodeVarintDmmaster(dAtA, i, uint64(len(m.Task))) i-- dAtA[i] = 0x12 } if len(m.ID) > 0 { i -= len(m.ID) copy(dAtA[i:], m.ID) i = encodeVarintDmmaster(dAtA, i, uint64(len(m.ID))) i-- dAtA[i] = 0xa } return len(dAtA) - i, nil } func (m *ShowDDLLocksResponse) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) if err != nil { return nil, err } return dAtA[:n], nil } func (m *ShowDDLLocksResponse) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } func (m *ShowDDLLocksResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int _ = l if len(m.Locks) > 0 { for iNdEx := len(m.Locks) - 1; iNdEx >= 0; iNdEx-- { { size, err := m.Locks[iNdEx].MarshalToSizedBuffer(dAtA[:i]) if err != nil { return 0, err } i -= size i = encodeVarintDmmaster(dAtA, i, uint64(size)) } i-- dAtA[i] = 0x1a } } if len(m.Msg) > 0 { i -= len(m.Msg) copy(dAtA[i:], m.Msg) i = encodeVarintDmmaster(dAtA, i, uint64(len(m.Msg))) i-- dAtA[i] = 0x12 } if m.Result { i-- if m.Result { dAtA[i] = 1 } else { dAtA[i] = 0 } i-- dAtA[i] = 0x8 } return len(dAtA) - i, nil } func (m *UnlockDDLLockRequest) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) if err != nil { return nil, err } return dAtA[:n], nil } func (m *UnlockDDLLockRequest) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } func (m *UnlockDDLLockRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int _ = l if len(m.Table) > 0 { i -= len(m.Table) copy(dAtA[i:], m.Table) i = encodeVarintDmmaster(dAtA, i, uint64(len(m.Table))) i-- dAtA[i] = 0x3a } if len(m.Database) > 0 { i -= len(m.Database) copy(dAtA[i:], m.Database) i = encodeVarintDmmaster(dAtA, i, uint64(len(m.Database))) i-- dAtA[i] = 0x32 } if len(m.Sources) > 0 { for iNdEx := len(m.Sources) - 1; iNdEx >= 0; iNdEx-- { i -= len(m.Sources[iNdEx]) copy(dAtA[i:], m.Sources[iNdEx]) i = encodeVarintDmmaster(dAtA, i, uint64(len(m.Sources[iNdEx]))) i-- dAtA[i] = 0x2a } } if m.Op != 0 { i = encodeVarintDmmaster(dAtA, i, uint64(m.Op)) i-- dAtA[i] = 0x20 } if m.ForceRemove { i-- if m.ForceRemove { dAtA[i] = 1 } else { dAtA[i] = 0 } i-- dAtA[i] = 0x18 } if len(m.ReplaceOwner) > 0 { i -= len(m.ReplaceOwner) copy(dAtA[i:], m.ReplaceOwner) i = encodeVarintDmmaster(dAtA, i, uint64(len(m.ReplaceOwner))) i-- dAtA[i] = 0x12 } if len(m.ID) > 0 { i -= len(m.ID) copy(dAtA[i:], m.ID) i = encodeVarintDmmaster(dAtA, i, uint64(len(m.ID))) i-- dAtA[i] = 0xa } return len(dAtA) - i, nil } func (m *UnlockDDLLockResponse) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) if err != nil { return nil, err } return dAtA[:n], nil } func (m *UnlockDDLLockResponse) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } func (m *UnlockDDLLockResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int _ = l if len(m.Msg) > 0 { i -= len(m.Msg) copy(dAtA[i:], m.Msg) i = encodeVarintDmmaster(dAtA, i, uint64(len(m.Msg))) i-- dAtA[i] = 0x12 } if m.Result { i-- if m.Result { dAtA[i] = 1 } else { dAtA[i] = 0 } i-- dAtA[i] = 0x8 } return len(dAtA) - i, nil } func (m *OperateWorkerRelayRequest) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) if err != nil { return nil, err } return dAtA[:n], nil } func (m *OperateWorkerRelayRequest) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } func (m *OperateWorkerRelayRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int _ = l if len(m.Sources) > 0 { for iNdEx := len(m.Sources) - 1; iNdEx >= 0; iNdEx-- { i -= len(m.Sources[iNdEx]) copy(dAtA[i:], m.Sources[iNdEx]) i = encodeVarintDmmaster(dAtA, i, uint64(len(m.Sources[iNdEx]))) i-- dAtA[i] = 0x12 } } if m.Op != 0 { i = encodeVarintDmmaster(dAtA, i, uint64(m.Op)) i-- dAtA[i] = 0x8 } return len(dAtA) - i, nil } func (m *OperateWorkerRelayResponse) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) if err != nil { return nil, err } return dAtA[:n], nil } func (m *OperateWorkerRelayResponse) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } func (m *OperateWorkerRelayResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int _ = l if len(m.Sources) > 0 { for iNdEx := len(m.Sources) - 1; iNdEx >= 0; iNdEx-- { { size, err := m.Sources[iNdEx].MarshalToSizedBuffer(dAtA[:i]) if err != nil { return 0, err } i -= size i = encodeVarintDmmaster(dAtA, i, uint64(size)) } i-- dAtA[i] = 0x22 } } if len(m.Msg) > 0 { i -= len(m.Msg) copy(dAtA[i:], m.Msg) i = encodeVarintDmmaster(dAtA, i, uint64(len(m.Msg))) i-- dAtA[i] = 0x1a } if m.Result { i-- if m.Result { dAtA[i] = 1 } else { dAtA[i] = 0 } i-- dAtA[i] = 0x10 } if m.Op != 0 { i = encodeVarintDmmaster(dAtA, i, uint64(m.Op)) i-- dAtA[i] = 0x8 } return len(dAtA) - i, nil } func (m *PurgeWorkerRelayRequest) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) if err != nil { return nil, err } return dAtA[:n], nil } func (m *PurgeWorkerRelayRequest) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } func (m *PurgeWorkerRelayRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int _ = l if len(m.SubDir) > 0 { i -= len(m.SubDir) copy(dAtA[i:], m.SubDir) i = encodeVarintDmmaster(dAtA, i, uint64(len(m.SubDir))) i-- dAtA[i] = 0x2a } if len(m.Filename) > 0 { i -= len(m.Filename) copy(dAtA[i:], m.Filename) i = encodeVarintDmmaster(dAtA, i, uint64(len(m.Filename))) i-- dAtA[i] = 0x22 } if m.Time != 0 { i = encodeVarintDmmaster(dAtA, i, uint64(m.Time)) i-- dAtA[i] = 0x18 } if m.Inactive { i-- if m.Inactive { dAtA[i] = 1 } else { dAtA[i] = 0 } i-- dAtA[i] = 0x10 } if len(m.Sources) > 0 { for iNdEx := len(m.Sources) - 1; iNdEx >= 0; iNdEx-- { i -= len(m.Sources[iNdEx]) copy(dAtA[i:], m.Sources[iNdEx]) i = encodeVarintDmmaster(dAtA, i, uint64(len(m.Sources[iNdEx]))) i-- dAtA[i] = 0xa } } return len(dAtA) - i, nil } func (m *PurgeWorkerRelayResponse) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) if err != nil { return nil, err } return dAtA[:n], nil } func (m *PurgeWorkerRelayResponse) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } func (m *PurgeWorkerRelayResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int _ = l if len(m.Sources) > 0 { for iNdEx := len(m.Sources) - 1; iNdEx >= 0; iNdEx-- { { size, err := m.Sources[iNdEx].MarshalToSizedBuffer(dAtA[:i]) if err != nil { return 0, err } i -= size i = encodeVarintDmmaster(dAtA, i, uint64(size)) } i-- dAtA[i] = 0x1a } } if len(m.Msg) > 0 { i -= len(m.Msg) copy(dAtA[i:], m.Msg) i = encodeVarintDmmaster(dAtA, i, uint64(len(m.Msg))) i-- dAtA[i] = 0x12 } if m.Result { i-- if m.Result { dAtA[i] = 1 } else { dAtA[i] = 0 } i-- dAtA[i] = 0x8 } return len(dAtA) - i, nil } func (m *CheckTaskRequest) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) if err != nil { return nil, err } return dAtA[:n], nil } func (m *CheckTaskRequest) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } func (m *CheckTaskRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int _ = l if len(m.StartTime) > 0 { i -= len(m.StartTime) copy(dAtA[i:], m.StartTime) i = encodeVarintDmmaster(dAtA, i, uint64(len(m.StartTime))) i-- dAtA[i] = 0x22 } if m.WarnCnt != 0 { i = encodeVarintDmmaster(dAtA, i, uint64(m.WarnCnt)) i-- dAtA[i] = 0x18 } if m.ErrCnt != 0 { i = encodeVarintDmmaster(dAtA, i, uint64(m.ErrCnt)) i-- dAtA[i] = 0x10 } if len(m.Task) > 0 { i -= len(m.Task) copy(dAtA[i:], m.Task) i = encodeVarintDmmaster(dAtA, i, uint64(len(m.Task))) i-- dAtA[i] = 0xa } return len(dAtA) - i, nil } func (m *CheckTaskResponse) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) if err != nil { return nil, err } return dAtA[:n], nil } func (m *CheckTaskResponse) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } func (m *CheckTaskResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int _ = l if len(m.Msg) > 0 { i -= len(m.Msg) copy(dAtA[i:], m.Msg) i = encodeVarintDmmaster(dAtA, i, uint64(len(m.Msg))) i-- dAtA[i] = 0x12 } if m.Result { i-- if m.Result { dAtA[i] = 1 } else { dAtA[i] = 0 } i-- dAtA[i] = 0x8 } return len(dAtA) - i, nil } func (m *OperateSourceRequest) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) if err != nil { return nil, err } return dAtA[:n], nil } func (m *OperateSourceRequest) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } func (m *OperateSourceRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int _ = l if len(m.WorkerName) > 0 { i -= len(m.WorkerName) copy(dAtA[i:], m.WorkerName) i = encodeVarintDmmaster(dAtA, i, uint64(len(m.WorkerName))) i-- dAtA[i] = 0x22 } if len(m.SourceID) > 0 { for iNdEx := len(m.SourceID) - 1; iNdEx >= 0; iNdEx-- { i -= len(m.SourceID[iNdEx]) copy(dAtA[i:], m.SourceID[iNdEx]) i = encodeVarintDmmaster(dAtA, i, uint64(len(m.SourceID[iNdEx]))) i-- dAtA[i] = 0x1a } } if len(m.Config) > 0 { for iNdEx := len(m.Config) - 1; iNdEx >= 0; iNdEx-- { i -= len(m.Config[iNdEx]) copy(dAtA[i:], m.Config[iNdEx]) i = encodeVarintDmmaster(dAtA, i, uint64(len(m.Config[iNdEx]))) i-- dAtA[i] = 0x12 } } if m.Op != 0 { i = encodeVarintDmmaster(dAtA, i, uint64(m.Op)) i-- dAtA[i] = 0x8 } return len(dAtA) - i, nil } func (m *OperateSourceResponse) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) if err != nil { return nil, err } return dAtA[:n], nil } func (m *OperateSourceResponse) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } func (m *OperateSourceResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int _ = l if len(m.Sources) > 0 { for iNdEx := len(m.Sources) - 1; iNdEx >= 0; iNdEx-- { { size, err := m.Sources[iNdEx].MarshalToSizedBuffer(dAtA[:i]) if err != nil { return 0, err } i -= size i = encodeVarintDmmaster(dAtA, i, uint64(size)) } i-- dAtA[i] = 0x1a } } if len(m.Msg) > 0 { i -= len(m.Msg) copy(dAtA[i:], m.Msg) i = encodeVarintDmmaster(dAtA, i, uint64(len(m.Msg))) i-- dAtA[i] = 0x12 } if m.Result { i-- if m.Result { dAtA[i] = 1 } else { dAtA[i] = 0 } i-- dAtA[i] = 0x8 } return len(dAtA) - i, nil } func (m *RegisterWorkerRequest) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) if err != nil { return nil, err } return dAtA[:n], nil } func (m *RegisterWorkerRequest) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } func (m *RegisterWorkerRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int _ = l if len(m.Address) > 0 { i -= len(m.Address) copy(dAtA[i:], m.Address) i = encodeVarintDmmaster(dAtA, i, uint64(len(m.Address))) i-- dAtA[i] = 0x12 } if len(m.Name) > 0 { i -= len(m.Name) copy(dAtA[i:], m.Name) i = encodeVarintDmmaster(dAtA, i, uint64(len(m.Name))) i-- dAtA[i] = 0xa } return len(dAtA) - i, nil } func (m *RegisterWorkerResponse) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) if err != nil { return nil, err } return dAtA[:n], nil } func (m *RegisterWorkerResponse) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } func (m *RegisterWorkerResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int _ = l if len(m.Msg) > 0 { i -= len(m.Msg) copy(dAtA[i:], m.Msg) i = encodeVarintDmmaster(dAtA, i, uint64(len(m.Msg))) i-- dAtA[i] = 0x12 } if m.Result { i-- if m.Result { dAtA[i] = 1 } else { dAtA[i] = 0 } i-- dAtA[i] = 0x8 } return len(dAtA) - i, nil } func (m *OfflineMemberRequest) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) if err != nil { return nil, err } return dAtA[:n], nil } func (m *OfflineMemberRequest) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } func (m *OfflineMemberRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int _ = l if len(m.Name) > 0 { i -= len(m.Name) copy(dAtA[i:], m.Name) i = encodeVarintDmmaster(dAtA, i, uint64(len(m.Name))) i-- dAtA[i] = 0x12 } if len(m.Type) > 0 { i -= len(m.Type) copy(dAtA[i:], m.Type) i = encodeVarintDmmaster(dAtA, i, uint64(len(m.Type))) i-- dAtA[i] = 0xa } return len(dAtA) - i, nil } func (m *OfflineMemberResponse) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) if err != nil { return nil, err } return dAtA[:n], nil } func (m *OfflineMemberResponse) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } func (m *OfflineMemberResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int _ = l if len(m.Msg) > 0 { i -= len(m.Msg) copy(dAtA[i:], m.Msg) i = encodeVarintDmmaster(dAtA, i, uint64(len(m.Msg))) i-- dAtA[i] = 0x12 } if m.Result { i-- if m.Result { dAtA[i] = 1 } else { dAtA[i] = 0 } i-- dAtA[i] = 0x8 } return len(dAtA) - i, nil } func (m *OperateLeaderRequest) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) if err != nil { return nil, err } return dAtA[:n], nil } func (m *OperateLeaderRequest) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } func (m *OperateLeaderRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int _ = l if m.Op != 0 { i = encodeVarintDmmaster(dAtA, i, uint64(m.Op)) i-- dAtA[i] = 0x8 } return len(dAtA) - i, nil } func (m *OperateLeaderResponse) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) if err != nil { return nil, err } return dAtA[:n], nil } func (m *OperateLeaderResponse) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } func (m *OperateLeaderResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int _ = l if len(m.Msg) > 0 { i -= len(m.Msg) copy(dAtA[i:], m.Msg) i = encodeVarintDmmaster(dAtA, i, uint64(len(m.Msg))) i-- dAtA[i] = 0x12 } if m.Result { i-- if m.Result { dAtA[i] = 1 } else { dAtA[i] = 0 } i-- dAtA[i] = 0x8 } return len(dAtA) - i, nil } func (m *MasterInfo) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) if err != nil { return nil, err } return dAtA[:n], nil } func (m *MasterInfo) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } func (m *MasterInfo) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int _ = l if len(m.ClientURLs) > 0 { for iNdEx := len(m.ClientURLs) - 1; iNdEx >= 0; iNdEx-- { i -= len(m.ClientURLs[iNdEx]) copy(dAtA[i:], m.ClientURLs[iNdEx]) i = encodeVarintDmmaster(dAtA, i, uint64(len(m.ClientURLs[iNdEx]))) i-- dAtA[i] = 0x2a } } if len(m.PeerURLs) > 0 { for iNdEx := len(m.PeerURLs) - 1; iNdEx >= 0; iNdEx-- { i -= len(m.PeerURLs[iNdEx]) copy(dAtA[i:], m.PeerURLs[iNdEx]) i = encodeVarintDmmaster(dAtA, i, uint64(len(m.PeerURLs[iNdEx]))) i-- dAtA[i] = 0x22 } } if m.Alive { i-- if m.Alive { dAtA[i] = 1 } else { dAtA[i] = 0 } i-- dAtA[i] = 0x18 } if m.MemberID != 0 { i = encodeVarintDmmaster(dAtA, i, uint64(m.MemberID)) i-- dAtA[i] = 0x10 } if len(m.Name) > 0 { i -= len(m.Name) copy(dAtA[i:], m.Name) i = encodeVarintDmmaster(dAtA, i, uint64(len(m.Name))) i-- dAtA[i] = 0xa } return len(dAtA) - i, nil } func (m *WorkerInfo) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) if err != nil { return nil, err } return dAtA[:n], nil } func (m *WorkerInfo) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } func (m *WorkerInfo) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int _ = l if len(m.Source) > 0 { i -= len(m.Source) copy(dAtA[i:], m.Source) i = encodeVarintDmmaster(dAtA, i, uint64(len(m.Source))) i-- dAtA[i] = 0x22 } if len(m.Stage) > 0 { i -= len(m.Stage) copy(dAtA[i:], m.Stage) i = encodeVarintDmmaster(dAtA, i, uint64(len(m.Stage))) i-- dAtA[i] = 0x1a } if len(m.Addr) > 0 { i -= len(m.Addr) copy(dAtA[i:], m.Addr) i = encodeVarintDmmaster(dAtA, i, uint64(len(m.Addr))) i-- dAtA[i] = 0x12 } if len(m.Name) > 0 { i -= len(m.Name) copy(dAtA[i:], m.Name) i = encodeVarintDmmaster(dAtA, i, uint64(len(m.Name))) i-- dAtA[i] = 0xa } return len(dAtA) - i, nil } func (m *ListLeaderMember) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) if err != nil { return nil, err } return dAtA[:n], nil } func (m *ListLeaderMember) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } func (m *ListLeaderMember) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int _ = l if len(m.Addr) > 0 { i -= len(m.Addr) copy(dAtA[i:], m.Addr) i = encodeVarintDmmaster(dAtA, i, uint64(len(m.Addr))) i-- dAtA[i] = 0x1a } if len(m.Name) > 0 { i -= len(m.Name) copy(dAtA[i:], m.Name) i = encodeVarintDmmaster(dAtA, i, uint64(len(m.Name))) i-- dAtA[i] = 0x12 } if len(m.Msg) > 0 { i -= len(m.Msg) copy(dAtA[i:], m.Msg) i = encodeVarintDmmaster(dAtA, i, uint64(len(m.Msg))) i-- dAtA[i] = 0xa } return len(dAtA) - i, nil } func (m *ListMasterMember) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) if err != nil { return nil, err } return dAtA[:n], nil } func (m *ListMasterMember) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } func (m *ListMasterMember) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int _ = l if len(m.Masters) > 0 { for iNdEx := len(m.Masters) - 1; iNdEx >= 0; iNdEx-- { { size, err := m.Masters[iNdEx].MarshalToSizedBuffer(dAtA[:i]) if err != nil { return 0, err } i -= size i = encodeVarintDmmaster(dAtA, i, uint64(size)) } i-- dAtA[i] = 0x12 } } if len(m.Msg) > 0 { i -= len(m.Msg) copy(dAtA[i:], m.Msg) i = encodeVarintDmmaster(dAtA, i, uint64(len(m.Msg))) i-- dAtA[i] = 0xa } return len(dAtA) - i, nil } func (m *ListWorkerMember) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) if err != nil { return nil, err } return dAtA[:n], nil } func (m *ListWorkerMember) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } func (m *ListWorkerMember) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int _ = l if len(m.Workers) > 0 { for iNdEx := len(m.Workers) - 1; iNdEx >= 0; iNdEx-- { { size, err := m.Workers[iNdEx].MarshalToSizedBuffer(dAtA[:i]) if err != nil { return 0, err } i -= size i = encodeVarintDmmaster(dAtA, i, uint64(size)) } i-- dAtA[i] = 0x12 } } if len(m.Msg) > 0 { i -= len(m.Msg) copy(dAtA[i:], m.Msg) i = encodeVarintDmmaster(dAtA, i, uint64(len(m.Msg))) i-- dAtA[i] = 0xa } return len(dAtA) - i, nil } func (m *Members) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) if err != nil { return nil, err } return dAtA[:n], nil } func (m *Members) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } func (m *Members) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int _ = l if m.Member != nil { { size := m.Member.Size() i -= size if _, err := m.Member.MarshalTo(dAtA[i:]); err != nil { return 0, err } } } return len(dAtA) - i, nil } func (m *Members_Leader) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } func (m *Members_Leader) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) if m.Leader != nil { { size, err := m.Leader.MarshalToSizedBuffer(dAtA[:i]) if err != nil { return 0, err } i -= size i = encodeVarintDmmaster(dAtA, i, uint64(size)) } i-- dAtA[i] = 0xa } return len(dAtA) - i, nil } func (m *Members_Master) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } func (m *Members_Master) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) if m.Master != nil { { size, err := m.Master.MarshalToSizedBuffer(dAtA[:i]) if err != nil { return 0, err } i -= size i = encodeVarintDmmaster(dAtA, i, uint64(size)) } i-- dAtA[i] = 0x12 } return len(dAtA) - i, nil } func (m *Members_Worker) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } func (m *Members_Worker) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) if m.Worker != nil { { size, err := m.Worker.MarshalToSizedBuffer(dAtA[:i]) if err != nil { return 0, err } i -= size i = encodeVarintDmmaster(dAtA, i, uint64(size)) } i-- dAtA[i] = 0x1a } return len(dAtA) - i, nil } func (m *ListMemberRequest) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) if err != nil { return nil, err } return dAtA[:n], nil } func (m *ListMemberRequest) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } func (m *ListMemberRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int _ = l if len(m.Names) > 0 { for iNdEx := len(m.Names) - 1; iNdEx >= 0; iNdEx-- { i -= len(m.Names[iNdEx]) copy(dAtA[i:], m.Names[iNdEx]) i = encodeVarintDmmaster(dAtA, i, uint64(len(m.Names[iNdEx]))) i-- dAtA[i] = 0x22 } } if m.Worker { i-- if m.Worker { dAtA[i] = 1 } else { dAtA[i] = 0 } i-- dAtA[i] = 0x18 } if m.Master { i-- if m.Master { dAtA[i] = 1 } else { dAtA[i] = 0 } i-- dAtA[i] = 0x10 } if m.Leader { i-- if m.Leader { dAtA[i] = 1 } else { dAtA[i] = 0 } i-- dAtA[i] = 0x8 } return len(dAtA) - i, nil } func (m *ListMemberResponse) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) if err != nil { return nil, err } return dAtA[:n], nil } func (m *ListMemberResponse) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } func (m *ListMemberResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int _ = l if len(m.Members) > 0 { for iNdEx := len(m.Members) - 1; iNdEx >= 0; iNdEx-- { { size, err := m.Members[iNdEx].MarshalToSizedBuffer(dAtA[:i]) if err != nil { return 0, err } i -= size i = encodeVarintDmmaster(dAtA, i, uint64(size)) } i-- dAtA[i] = 0x1a } } if len(m.Msg) > 0 { i -= len(m.Msg) copy(dAtA[i:], m.Msg) i = encodeVarintDmmaster(dAtA, i, uint64(len(m.Msg))) i-- dAtA[i] = 0x12 } if m.Result { i-- if m.Result { dAtA[i] = 1 } else { dAtA[i] = 0 } i-- dAtA[i] = 0x8 } return len(dAtA) - i, nil } func (m *OperateSchemaRequest) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) if err != nil { return nil, err } return dAtA[:n], nil } func (m *OperateSchemaRequest) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } func (m *OperateSchemaRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int _ = l if m.FromTarget { i-- if m.FromTarget { dAtA[i] = 1 } else { dAtA[i] = 0 } i-- dAtA[i] = 0x50 } if m.FromSource { i-- if m.FromSource { dAtA[i] = 1 } else { dAtA[i] = 0 } i-- dAtA[i] = 0x48 } if m.Sync { i-- if m.Sync { dAtA[i] = 1 } else { dAtA[i] = 0 } i-- dAtA[i] = 0x40 } if m.Flush { i-- if m.Flush { dAtA[i] = 1 } else { dAtA[i] = 0 } i-- dAtA[i] = 0x38 } if len(m.Schema) > 0 { i -= len(m.Schema) copy(dAtA[i:], m.Schema) i = encodeVarintDmmaster(dAtA, i, uint64(len(m.Schema))) i-- dAtA[i] = 0x32 } if len(m.Table) > 0 { i -= len(m.Table) copy(dAtA[i:], m.Table) i = encodeVarintDmmaster(dAtA, i, uint64(len(m.Table))) i-- dAtA[i] = 0x2a } if len(m.Database) > 0 { i -= len(m.Database) copy(dAtA[i:], m.Database) i = encodeVarintDmmaster(dAtA, i, uint64(len(m.Database))) i-- dAtA[i] = 0x22 } if len(m.Sources) > 0 { for iNdEx := len(m.Sources) - 1; iNdEx >= 0; iNdEx-- { i -= len(m.Sources[iNdEx]) copy(dAtA[i:], m.Sources[iNdEx]) i = encodeVarintDmmaster(dAtA, i, uint64(len(m.Sources[iNdEx]))) i-- dAtA[i] = 0x1a } } if len(m.Task) > 0 { i -= len(m.Task) copy(dAtA[i:], m.Task) i = encodeVarintDmmaster(dAtA, i, uint64(len(m.Task))) i-- dAtA[i] = 0x12 } if m.Op != 0 { i = encodeVarintDmmaster(dAtA, i, uint64(m.Op)) i-- dAtA[i] = 0x8 } return len(dAtA) - i, nil } func (m *OperateSchemaResponse) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) if err != nil { return nil, err } return dAtA[:n], nil } func (m *OperateSchemaResponse) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } func (m *OperateSchemaResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int _ = l if len(m.Sources) > 0 { for iNdEx := len(m.Sources) - 1; iNdEx >= 0; iNdEx-- { { size, err := m.Sources[iNdEx].MarshalToSizedBuffer(dAtA[:i]) if err != nil { return 0, err } i -= size i = encodeVarintDmmaster(dAtA, i, uint64(size)) } i-- dAtA[i] = 0x1a } } if len(m.Msg) > 0 { i -= len(m.Msg) copy(dAtA[i:], m.Msg) i = encodeVarintDmmaster(dAtA, i, uint64(len(m.Msg))) i-- dAtA[i] = 0x12 } if m.Result { i-- if m.Result { dAtA[i] = 1 } else { dAtA[i] = 0 } i-- dAtA[i] = 0x8 } return len(dAtA) - i, nil } func (m *GetSubTaskCfgRequest) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) if err != nil { return nil, err } return dAtA[:n], nil } func (m *GetSubTaskCfgRequest) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } func (m *GetSubTaskCfgRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int _ = l if len(m.Name) > 0 { i -= len(m.Name) copy(dAtA[i:], m.Name) i = encodeVarintDmmaster(dAtA, i, uint64(len(m.Name))) i-- dAtA[i] = 0xa } return len(dAtA) - i, nil } func (m *GetSubTaskCfgResponse) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) if err != nil { return nil, err } return dAtA[:n], nil } func (m *GetSubTaskCfgResponse) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } func (m *GetSubTaskCfgResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int _ = l if len(m.Cfgs) > 0 { for iNdEx := len(m.Cfgs) - 1; iNdEx >= 0; iNdEx-- { i -= len(m.Cfgs[iNdEx]) copy(dAtA[i:], m.Cfgs[iNdEx]) i = encodeVarintDmmaster(dAtA, i, uint64(len(m.Cfgs[iNdEx]))) i-- dAtA[i] = 0x1a } } if len(m.Msg) > 0 { i -= len(m.Msg) copy(dAtA[i:], m.Msg) i = encodeVarintDmmaster(dAtA, i, uint64(len(m.Msg))) i-- dAtA[i] = 0x12 } if m.Result { i-- if m.Result { dAtA[i] = 1 } else { dAtA[i] = 0 } i-- dAtA[i] = 0x8 } return len(dAtA) - i, nil } func (m *GetCfgRequest) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) if err != nil { return nil, err } return dAtA[:n], nil } func (m *GetCfgRequest) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } func (m *GetCfgRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int _ = l if len(m.Name) > 0 { i -= len(m.Name) copy(dAtA[i:], m.Name) i = encodeVarintDmmaster(dAtA, i, uint64(len(m.Name))) i-- dAtA[i] = 0x12 } if m.Type != 0 { i = encodeVarintDmmaster(dAtA, i, uint64(m.Type)) i-- dAtA[i] = 0x8 } return len(dAtA) - i, nil } func (m *GetCfgResponse) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) if err != nil { return nil, err } return dAtA[:n], nil } func (m *GetCfgResponse) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } func (m *GetCfgResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int _ = l if len(m.Cfg) > 0 { i -= len(m.Cfg) copy(dAtA[i:], m.Cfg) i = encodeVarintDmmaster(dAtA, i, uint64(len(m.Cfg))) i-- dAtA[i] = 0x1a } if len(m.Msg) > 0 { i -= len(m.Msg) copy(dAtA[i:], m.Msg) i = encodeVarintDmmaster(dAtA, i, uint64(len(m.Msg))) i-- dAtA[i] = 0x12 } if m.Result { i-- if m.Result { dAtA[i] = 1 } else { dAtA[i] = 0 } i-- dAtA[i] = 0x8 } return len(dAtA) - i, nil } func (m *GetMasterCfgRequest) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) if err != nil { return nil, err } return dAtA[:n], nil } func (m *GetMasterCfgRequest) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } func (m *GetMasterCfgRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int _ = l return len(dAtA) - i, nil } func (m *GetMasterCfgResponse) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) if err != nil { return nil, err } return dAtA[:n], nil } func (m *GetMasterCfgResponse) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } func (m *GetMasterCfgResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int _ = l if len(m.Cfg) > 0 { i -= len(m.Cfg) copy(dAtA[i:], m.Cfg) i = encodeVarintDmmaster(dAtA, i, uint64(len(m.Cfg))) i-- dAtA[i] = 0xa } return len(dAtA) - i, nil } func (m *HandleErrorRequest) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) if err != nil { return nil, err } return dAtA[:n], nil } func (m *HandleErrorRequest) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } func (m *HandleErrorRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int _ = l if len(m.Sqls) > 0 { for iNdEx := len(m.Sqls) - 1; iNdEx >= 0; iNdEx-- { i -= len(m.Sqls[iNdEx]) copy(dAtA[i:], m.Sqls[iNdEx]) i = encodeVarintDmmaster(dAtA, i, uint64(len(m.Sqls[iNdEx]))) i-- dAtA[i] = 0x2a } } if len(m.BinlogPos) > 0 { i -= len(m.BinlogPos) copy(dAtA[i:], m.BinlogPos) i = encodeVarintDmmaster(dAtA, i, uint64(len(m.BinlogPos))) i-- dAtA[i] = 0x22 } if len(m.Sources) > 0 { for iNdEx := len(m.Sources) - 1; iNdEx >= 0; iNdEx-- { i -= len(m.Sources[iNdEx]) copy(dAtA[i:], m.Sources[iNdEx]) i = encodeVarintDmmaster(dAtA, i, uint64(len(m.Sources[iNdEx]))) i-- dAtA[i] = 0x1a } } if len(m.Task) > 0 { i -= len(m.Task) copy(dAtA[i:], m.Task) i = encodeVarintDmmaster(dAtA, i, uint64(len(m.Task))) i-- dAtA[i] = 0x12 } if m.Op != 0 { i = encodeVarintDmmaster(dAtA, i, uint64(m.Op)) i-- dAtA[i] = 0x8 } return len(dAtA) - i, nil } func (m *HandleErrorResponse) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) if err != nil { return nil, err } return dAtA[:n], nil } func (m *HandleErrorResponse) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } func (m *HandleErrorResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int _ = l if len(m.Sources) > 0 { for iNdEx := len(m.Sources) - 1; iNdEx >= 0; iNdEx-- { { size, err := m.Sources[iNdEx].MarshalToSizedBuffer(dAtA[:i]) if err != nil { return 0, err } i -= size i = encodeVarintDmmaster(dAtA, i, uint64(size)) } i-- dAtA[i] = 0x1a } } if len(m.Msg) > 0 { i -= len(m.Msg) copy(dAtA[i:], m.Msg) i = encodeVarintDmmaster(dAtA, i, uint64(len(m.Msg))) i-- dAtA[i] = 0x12 } if m.Result { i-- if m.Result { dAtA[i] = 1 } else { dAtA[i] = 0 } i-- dAtA[i] = 0x8 } return len(dAtA) - i, nil } func (m *TransferSourceRequest) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) if err != nil { return nil, err } return dAtA[:n], nil } func (m *TransferSourceRequest) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } func (m *TransferSourceRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int _ = l if len(m.Worker) > 0 { i -= len(m.Worker) copy(dAtA[i:], m.Worker) i = encodeVarintDmmaster(dAtA, i, uint64(len(m.Worker))) i-- dAtA[i] = 0x12 } if len(m.Source) > 0 { i -= len(m.Source) copy(dAtA[i:], m.Source) i = encodeVarintDmmaster(dAtA, i, uint64(len(m.Source))) i-- dAtA[i] = 0xa } return len(dAtA) - i, nil } func (m *TransferSourceResponse) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) if err != nil { return nil, err } return dAtA[:n], nil } func (m *TransferSourceResponse) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } func (m *TransferSourceResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int _ = l if len(m.Msg) > 0 { i -= len(m.Msg) copy(dAtA[i:], m.Msg) i = encodeVarintDmmaster(dAtA, i, uint64(len(m.Msg))) i-- dAtA[i] = 0x12 } if m.Result { i-- if m.Result { dAtA[i] = 1 } else { dAtA[i] = 0 } i-- dAtA[i] = 0x8 } return len(dAtA) - i, nil } func (m *OperateRelayRequest) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) if err != nil { return nil, err } return dAtA[:n], nil } func (m *OperateRelayRequest) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } func (m *OperateRelayRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int _ = l if len(m.Worker) > 0 { for iNdEx := len(m.Worker) - 1; iNdEx >= 0; iNdEx-- { i -= len(m.Worker[iNdEx]) copy(dAtA[i:], m.Worker[iNdEx]) i = encodeVarintDmmaster(dAtA, i, uint64(len(m.Worker[iNdEx]))) i-- dAtA[i] = 0x1a } } if len(m.Source) > 0 { i -= len(m.Source) copy(dAtA[i:], m.Source) i = encodeVarintDmmaster(dAtA, i, uint64(len(m.Source))) i-- dAtA[i] = 0x12 } if m.Op != 0 { i = encodeVarintDmmaster(dAtA, i, uint64(m.Op)) i-- dAtA[i] = 0x8 } return len(dAtA) - i, nil } func (m *OperateRelayResponse) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) if err != nil { return nil, err } return dAtA[:n], nil } func (m *OperateRelayResponse) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } func (m *OperateRelayResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int _ = l if len(m.Sources) > 0 { for iNdEx := len(m.Sources) - 1; iNdEx >= 0; iNdEx-- { { size, err := m.Sources[iNdEx].MarshalToSizedBuffer(dAtA[:i]) if err != nil { return 0, err } i -= size i = encodeVarintDmmaster(dAtA, i, uint64(size)) } i-- dAtA[i] = 0x1a } } if len(m.Msg) > 0 { i -= len(m.Msg) copy(dAtA[i:], m.Msg) i = encodeVarintDmmaster(dAtA, i, uint64(len(m.Msg))) i-- dAtA[i] = 0x12 } if m.Result { i-- if m.Result { dAtA[i] = 1 } else { dAtA[i] = 0 } i-- dAtA[i] = 0x8 } return len(dAtA) - i, nil } func (m *StartValidationRequest) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) if err != nil { return nil, err } return dAtA[:n], nil } func (m *StartValidationRequest) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } func (m *StartValidationRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int _ = l if len(m.TaskName) > 0 { i -= len(m.TaskName) copy(dAtA[i:], m.TaskName) i = encodeVarintDmmaster(dAtA, i, uint64(len(m.TaskName))) i-- dAtA[i] = 0x22 } if len(m.Sources) > 0 { for iNdEx := len(m.Sources) - 1; iNdEx >= 0; iNdEx-- { i -= len(m.Sources[iNdEx]) copy(dAtA[i:], m.Sources[iNdEx]) i = encodeVarintDmmaster(dAtA, i, uint64(len(m.Sources[iNdEx]))) i-- dAtA[i] = 0x1a } } if len(m.FromTime) > 0 { i -= len(m.FromTime) copy(dAtA[i:], m.FromTime) i = encodeVarintDmmaster(dAtA, i, uint64(len(m.FromTime))) i-- dAtA[i] = 0x12 } if len(m.Mode) > 0 { i -= len(m.Mode) copy(dAtA[i:], m.Mode) i = encodeVarintDmmaster(dAtA, i, uint64(len(m.Mode))) i-- dAtA[i] = 0xa } return len(dAtA) - i, nil } func (m *StartValidationResponse) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) if err != nil { return nil, err } return dAtA[:n], nil } func (m *StartValidationResponse) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } func (m *StartValidationResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int _ = l if len(m.Sources) > 0 { for iNdEx := len(m.Sources) - 1; iNdEx >= 0; iNdEx-- { { size, err := m.Sources[iNdEx].MarshalToSizedBuffer(dAtA[:i]) if err != nil { return 0, err } i -= size i = encodeVarintDmmaster(dAtA, i, uint64(size)) } i-- dAtA[i] = 0x1a } } if len(m.Msg) > 0 { i -= len(m.Msg) copy(dAtA[i:], m.Msg) i = encodeVarintDmmaster(dAtA, i, uint64(len(m.Msg))) i-- dAtA[i] = 0x12 } if m.Result { i-- if m.Result { dAtA[i] = 1 } else { dAtA[i] = 0 } i-- dAtA[i] = 0x8 } return len(dAtA) - i, nil } func (m *StopValidationRequest) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) if err != nil { return nil, err } return dAtA[:n], nil } func (m *StopValidationRequest) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } func (m *StopValidationRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int _ = l if len(m.TaskName) > 0 { i -= len(m.TaskName) copy(dAtA[i:], m.TaskName) i = encodeVarintDmmaster(dAtA, i, uint64(len(m.TaskName))) i-- dAtA[i] = 0x12 } if len(m.Sources) > 0 { for iNdEx := len(m.Sources) - 1; iNdEx >= 0; iNdEx-- { i -= len(m.Sources[iNdEx]) copy(dAtA[i:], m.Sources[iNdEx]) i = encodeVarintDmmaster(dAtA, i, uint64(len(m.Sources[iNdEx]))) i-- dAtA[i] = 0xa } } return len(dAtA) - i, nil } func (m *StopValidationResponse) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) if err != nil { return nil, err } return dAtA[:n], nil } func (m *StopValidationResponse) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } func (m *StopValidationResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int _ = l if len(m.Sources) > 0 { for iNdEx := len(m.Sources) - 1; iNdEx >= 0; iNdEx-- { { size, err := m.Sources[iNdEx].MarshalToSizedBuffer(dAtA[:i]) if err != nil { return 0, err } i -= size i = encodeVarintDmmaster(dAtA, i, uint64(size)) } i-- dAtA[i] = 0x1a } } if len(m.Msg) > 0 { i -= len(m.Msg) copy(dAtA[i:], m.Msg) i = encodeVarintDmmaster(dAtA, i, uint64(len(m.Msg))) i-- dAtA[i] = 0x12 } if m.Result { i-- if m.Result { dAtA[i] = 1 } else { dAtA[i] = 0 } i-- dAtA[i] = 0x8 } return len(dAtA) - i, nil } func encodeVarintDmmaster(dAtA []byte, offset int, v uint64) int { offset -= sovDmmaster(v) base := offset for v >= 1<<7 { dAtA[offset] = uint8(v&0x7f | 0x80) v >>= 7 offset++ } dAtA[offset] = uint8(v) return base } func (m *StartTaskRequest) Size() (n int) { if m == nil { return 0 } var l int _ = l l = len(m.Task) if l > 0 { n += 1 + l + sovDmmaster(uint64(l)) } if len(m.Sources) > 0 { for _, s := range m.Sources { l = len(s) n += 1 + l + sovDmmaster(uint64(l)) } } if m.RemoveMeta { n += 2 } l = len(m.StartTime) if l > 0 { n += 1 + l + sovDmmaster(uint64(l)) } return n } func (m *StartTaskResponse) Size() (n int) { if m == nil { return 0 } var l int _ = l if m.Result { n += 2 } l = len(m.Msg) if l > 0 { n += 1 + l + sovDmmaster(uint64(l)) } if len(m.Sources) > 0 { for _, e := range m.Sources { l = e.Size() n += 1 + l + sovDmmaster(uint64(l)) } } l = len(m.CheckResult) if l > 0 { n += 1 + l + sovDmmaster(uint64(l)) } return n } func (m *OperateTaskRequest) Size() (n int) { if m == nil { return 0 } var l int _ = l if m.Op != 0 { n += 1 + sovDmmaster(uint64(m.Op)) } l = len(m.Name) if l > 0 { n += 1 + l + sovDmmaster(uint64(l)) } if len(m.Sources) > 0 { for _, s := range m.Sources { l = len(s) n += 1 + l + sovDmmaster(uint64(l)) } } return n } func (m *OperateTaskResponse) Size() (n int) { if m == nil { return 0 } var l int _ = l if m.Op != 0 { n += 1 + sovDmmaster(uint64(m.Op)) } if m.Result { n += 2 } l = len(m.Msg) if l > 0 { n += 1 + l + sovDmmaster(uint64(l)) } if len(m.Sources) > 0 { for _, e := range m.Sources { l = e.Size() n += 1 + l + sovDmmaster(uint64(l)) } } return n } func (m *UpdateTaskRequest) Size() (n int) { if m == nil { return 0 } var l int _ = l l = len(m.Task) if l > 0 { n += 1 + l + sovDmmaster(uint64(l)) } if len(m.Sources) > 0 { for _, s := range m.Sources { l = len(s) n += 1 + l + sovDmmaster(uint64(l)) } } return n } func (m *UpdateTaskResponse) Size() (n int) { if m == nil { return 0 } var l int _ = l if m.Result { n += 2 } l = len(m.Msg) if l > 0 { n += 1 + l + sovDmmaster(uint64(l)) } if len(m.Sources) > 0 { for _, e := range m.Sources { l = e.Size() n += 1 + l + sovDmmaster(uint64(l)) } } l = len(m.CheckResult) if l > 0 { n += 1 + l + sovDmmaster(uint64(l)) } return n } func (m *QueryStatusListRequest) Size() (n int) { if m == nil { return 0 } var l int _ = l l = len(m.Name) if l > 0 { n += 1 + l + sovDmmaster(uint64(l)) } if len(m.Sources) > 0 { for _, s := range m.Sources { l = len(s) n += 1 + l + sovDmmaster(uint64(l)) } } return n } func (m *QueryStatusListResponse) Size() (n int) { if m == nil { return 0 } var l int _ = l if m.Result { n += 2 } l = len(m.Msg) if l > 0 { n += 1 + l + sovDmmaster(uint64(l)) } if len(m.Sources) > 0 { for _, e := range m.Sources { l = e.Size() n += 1 + l + sovDmmaster(uint64(l)) } } return n } func (m *ShowDDLLocksRequest) Size() (n int) { if m == nil { return 0 } var l int _ = l l = len(m.Task) if l > 0 { n += 1 + l + sovDmmaster(uint64(l)) } if len(m.Sources) > 0 { for _, s := range m.Sources { l = len(s) n += 1 + l + sovDmmaster(uint64(l)) } } return n } func (m *DDLLock) Size() (n int) { if m == nil { return 0 } var l int _ = l l = len(m.ID) if l > 0 { n += 1 + l + sovDmmaster(uint64(l)) } l = len(m.Task) if l > 0 { n += 1 + l + sovDmmaster(uint64(l)) } l = len(m.Mode) if l > 0 { n += 1 + l + sovDmmaster(uint64(l)) } l = len(m.Owner) if l > 0 { n += 1 + l + sovDmmaster(uint64(l)) } if len(m.DDLs) > 0 { for _, s := range m.DDLs { l = len(s) n += 1 + l + sovDmmaster(uint64(l)) } } if len(m.Synced) > 0 { for _, s := range m.Synced { l = len(s) n += 1 + l + sovDmmaster(uint64(l)) } } if len(m.Unsynced) > 0 { for _, s := range m.Unsynced { l = len(s) n += 1 + l + sovDmmaster(uint64(l)) } } return n } func (m *ShowDDLLocksResponse) Size() (n int) { if m == nil { return 0 } var l int _ = l if m.Result { n += 2 } l = len(m.Msg) if l > 0 { n += 1 + l + sovDmmaster(uint64(l)) } if len(m.Locks) > 0 { for _, e := range m.Locks { l = e.Size() n += 1 + l + sovDmmaster(uint64(l)) } } return n } func (m *UnlockDDLLockRequest) Size() (n int) { if m == nil { return 0 } var l int _ = l l = len(m.ID) if l > 0 { n += 1 + l + sovDmmaster(uint64(l)) } l = len(m.ReplaceOwner) if l > 0 { n += 1 + l + sovDmmaster(uint64(l)) } if m.ForceRemove { n += 2 } if m.Op != 0 { n += 1 + sovDmmaster(uint64(m.Op)) } if len(m.Sources) > 0 { for _, s := range m.Sources { l = len(s) n += 1 + l + sovDmmaster(uint64(l)) } } l = len(m.Database) if l > 0 { n += 1 + l + sovDmmaster(uint64(l)) } l = len(m.Table) if l > 0 { n += 1 + l + sovDmmaster(uint64(l)) } return n } func (m *UnlockDDLLockResponse) Size() (n int) { if m == nil { return 0 } var l int _ = l if m.Result { n += 2 } l = len(m.Msg) if l > 0 { n += 1 + l + sovDmmaster(uint64(l)) } return n } func (m *OperateWorkerRelayRequest) Size() (n int) { if m == nil { return 0 } var l int _ = l if m.Op != 0 { n += 1 + sovDmmaster(uint64(m.Op)) } if len(m.Sources) > 0 { for _, s := range m.Sources { l = len(s) n += 1 + l + sovDmmaster(uint64(l)) } } return n } func (m *OperateWorkerRelayResponse) Size() (n int) { if m == nil { return 0 } var l int _ = l if m.Op != 0 { n += 1 + sovDmmaster(uint64(m.Op)) } if m.Result { n += 2 } l = len(m.Msg) if l > 0 { n += 1 + l + sovDmmaster(uint64(l)) } if len(m.Sources) > 0 { for _, e := range m.Sources { l = e.Size() n += 1 + l + sovDmmaster(uint64(l)) } } return n } func (m *PurgeWorkerRelayRequest) Size() (n int) { if m == nil { return 0 } var l int _ = l if len(m.Sources) > 0 { for _, s := range m.Sources { l = len(s) n += 1 + l + sovDmmaster(uint64(l)) } } if m.Inactive { n += 2 } if m.Time != 0 { n += 1 + sovDmmaster(uint64(m.Time)) } l = len(m.Filename) if l > 0 { n += 1 + l + sovDmmaster(uint64(l)) } l = len(m.SubDir) if l > 0 { n += 1 + l + sovDmmaster(uint64(l)) } return n } func (m *PurgeWorkerRelayResponse) Size() (n int) { if m == nil { return 0 } var l int _ = l if m.Result { n += 2 } l = len(m.Msg) if l > 0 { n += 1 + l + sovDmmaster(uint64(l)) } if len(m.Sources) > 0 { for _, e := range m.Sources { l = e.Size() n += 1 + l + sovDmmaster(uint64(l)) } } return n } func (m *CheckTaskRequest) Size() (n int) { if m == nil { return 0 } var l int _ = l l = len(m.Task) if l > 0 { n += 1 + l + sovDmmaster(uint64(l)) } if m.ErrCnt != 0 { n += 1 + sovDmmaster(uint64(m.ErrCnt)) } if m.WarnCnt != 0 { n += 1 + sovDmmaster(uint64(m.WarnCnt)) } l = len(m.StartTime) if l > 0 { n += 1 + l + sovDmmaster(uint64(l)) } return n } func (m *CheckTaskResponse) Size() (n int) { if m == nil { return 0 } var l int _ = l if m.Result { n += 2 } l = len(m.Msg) if l > 0 { n += 1 + l + sovDmmaster(uint64(l)) } return n } func (m *OperateSourceRequest) Size() (n int) { if m == nil { return 0 } var l int _ = l if m.Op != 0 { n += 1 + sovDmmaster(uint64(m.Op)) } if len(m.Config) > 0 { for _, s := range m.Config { l = len(s) n += 1 + l + sovDmmaster(uint64(l)) } } if len(m.SourceID) > 0 { for _, s := range m.SourceID { l = len(s) n += 1 + l + sovDmmaster(uint64(l)) } } l = len(m.WorkerName) if l > 0 { n += 1 + l + sovDmmaster(uint64(l)) } return n } func (m *OperateSourceResponse) Size() (n int) { if m == nil { return 0 } var l int _ = l if m.Result { n += 2 } l = len(m.Msg) if l > 0 { n += 1 + l + sovDmmaster(uint64(l)) } if len(m.Sources) > 0 { for _, e := range m.Sources { l = e.Size() n += 1 + l + sovDmmaster(uint64(l)) } } return n } func (m *RegisterWorkerRequest) Size() (n int) { if m == nil { return 0 } var l int _ = l l = len(m.Name) if l > 0 { n += 1 + l + sovDmmaster(uint64(l)) } l = len(m.Address) if l > 0 { n += 1 + l + sovDmmaster(uint64(l)) } return n } func (m *RegisterWorkerResponse) Size() (n int) { if m == nil { return 0 } var l int _ = l if m.Result { n += 2 } l = len(m.Msg) if l > 0 { n += 1 + l + sovDmmaster(uint64(l)) } return n } func (m *OfflineMemberRequest) Size() (n int) { if m == nil { return 0 } var l int _ = l l = len(m.Type) if l > 0 { n += 1 + l + sovDmmaster(uint64(l)) } l = len(m.Name) if l > 0 { n += 1 + l + sovDmmaster(uint64(l)) } return n } func (m *OfflineMemberResponse) Size() (n int) { if m == nil { return 0 } var l int _ = l if m.Result { n += 2 } l = len(m.Msg) if l > 0 { n += 1 + l + sovDmmaster(uint64(l)) } return n } func (m *OperateLeaderRequest) Size() (n int) { if m == nil { return 0 } var l int _ = l if m.Op != 0 { n += 1 + sovDmmaster(uint64(m.Op)) } return n } func (m *OperateLeaderResponse) Size() (n int) { if m == nil { return 0 } var l int _ = l if m.Result { n += 2 } l = len(m.Msg) if l > 0 { n += 1 + l + sovDmmaster(uint64(l)) } return n } func (m *MasterInfo) Size() (n int) { if m == nil { return 0 } var l int _ = l l = len(m.Name) if l > 0 { n += 1 + l + sovDmmaster(uint64(l)) } if m.MemberID != 0 { n += 1 + sovDmmaster(uint64(m.MemberID)) } if m.Alive { n += 2 } if len(m.PeerURLs) > 0 { for _, s := range m.PeerURLs { l = len(s) n += 1 + l + sovDmmaster(uint64(l)) } } if len(m.ClientURLs) > 0 { for _, s := range m.ClientURLs { l = len(s) n += 1 + l + sovDmmaster(uint64(l)) } } return n } func (m *WorkerInfo) Size() (n int) { if m == nil { return 0 } var l int _ = l l = len(m.Name) if l > 0 { n += 1 + l + sovDmmaster(uint64(l)) } l = len(m.Addr) if l > 0 { n += 1 + l + sovDmmaster(uint64(l)) } l = len(m.Stage) if l > 0 { n += 1 + l + sovDmmaster(uint64(l)) } l = len(m.Source) if l > 0 { n += 1 + l + sovDmmaster(uint64(l)) } return n } func (m *ListLeaderMember) Size() (n int) { if m == nil { return 0 } var l int _ = l l = len(m.Msg) if l > 0 { n += 1 + l + sovDmmaster(uint64(l)) } l = len(m.Name) if l > 0 { n += 1 + l + sovDmmaster(uint64(l)) } l = len(m.Addr) if l > 0 { n += 1 + l + sovDmmaster(uint64(l)) } return n } func (m *ListMasterMember) Size() (n int) { if m == nil { return 0 } var l int _ = l l = len(m.Msg) if l > 0 { n += 1 + l + sovDmmaster(uint64(l)) } if len(m.Masters) > 0 { for _, e := range m.Masters { l = e.Size() n += 1 + l + sovDmmaster(uint64(l)) } } return n } func (m *ListWorkerMember) Size() (n int) { if m == nil { return 0 } var l int _ = l l = len(m.Msg) if l > 0 { n += 1 + l + sovDmmaster(uint64(l)) } if len(m.Workers) > 0 { for _, e := range m.Workers { l = e.Size() n += 1 + l + sovDmmaster(uint64(l)) } } return n } func (m *Members) Size() (n int) { if m == nil { return 0 } var l int _ = l if m.Member != nil { n += m.Member.Size() } return n } func (m *Members_Leader) Size() (n int) { if m == nil { return 0 } var l int _ = l if m.Leader != nil { l = m.Leader.Size() n += 1 + l + sovDmmaster(uint64(l)) } return n } func (m *Members_Master) Size() (n int) { if m == nil { return 0 } var l int _ = l if m.Master != nil { l = m.Master.Size() n += 1 + l + sovDmmaster(uint64(l)) } return n } func (m *Members_Worker) Size() (n int) { if m == nil { return 0 } var l int _ = l if m.Worker != nil { l = m.Worker.Size() n += 1 + l + sovDmmaster(uint64(l)) } return n } func (m *ListMemberRequest) Size() (n int) { if m == nil { return 0 } var l int _ = l if m.Leader { n += 2 } if m.Master { n += 2 } if m.Worker { n += 2 } if len(m.Names) > 0 { for _, s := range m.Names { l = len(s) n += 1 + l + sovDmmaster(uint64(l)) } } return n } func (m *ListMemberResponse) Size() (n int) { if m == nil { return 0 } var l int _ = l if m.Result { n += 2 } l = len(m.Msg) if l > 0 { n += 1 + l + sovDmmaster(uint64(l)) } if len(m.Members) > 0 { for _, e := range m.Members { l = e.Size() n += 1 + l + sovDmmaster(uint64(l)) } } return n } func (m *OperateSchemaRequest) Size() (n int) { if m == nil { return 0 } var l int _ = l if m.Op != 0 { n += 1 + sovDmmaster(uint64(m.Op)) } l = len(m.Task) if l > 0 { n += 1 + l + sovDmmaster(uint64(l)) } if len(m.Sources) > 0 { for _, s := range m.Sources { l = len(s) n += 1 + l + sovDmmaster(uint64(l)) } } l = len(m.Database) if l > 0 { n += 1 + l + sovDmmaster(uint64(l)) } l = len(m.Table) if l > 0 { n += 1 + l + sovDmmaster(uint64(l)) } l = len(m.Schema) if l > 0 { n += 1 + l + sovDmmaster(uint64(l)) } if m.Flush { n += 2 } if m.Sync { n += 2 } if m.FromSource { n += 2 } if m.FromTarget { n += 2 } return n } func (m *OperateSchemaResponse) Size() (n int) { if m == nil { return 0 } var l int _ = l if m.Result { n += 2 } l = len(m.Msg) if l > 0 { n += 1 + l + sovDmmaster(uint64(l)) } if len(m.Sources) > 0 { for _, e := range m.Sources { l = e.Size() n += 1 + l + sovDmmaster(uint64(l)) } } return n } func (m *GetSubTaskCfgRequest) Size() (n int) { if m == nil { return 0 } var l int _ = l l = len(m.Name) if l > 0 { n += 1 + l + sovDmmaster(uint64(l)) } return n } func (m *GetSubTaskCfgResponse) Size() (n int) { if m == nil { return 0 } var l int _ = l if m.Result { n += 2 } l = len(m.Msg) if l > 0 { n += 1 + l + sovDmmaster(uint64(l)) } if len(m.Cfgs) > 0 { for _, s := range m.Cfgs { l = len(s) n += 1 + l + sovDmmaster(uint64(l)) } } return n } func (m *GetCfgRequest) Size() (n int) { if m == nil { return 0 } var l int _ = l if m.Type != 0 { n += 1 + sovDmmaster(uint64(m.Type)) } l = len(m.Name) if l > 0 { n += 1 + l + sovDmmaster(uint64(l)) } return n } func (m *GetCfgResponse) Size() (n int) { if m == nil { return 0 } var l int _ = l if m.Result { n += 2 } l = len(m.Msg) if l > 0 { n += 1 + l + sovDmmaster(uint64(l)) } l = len(m.Cfg) if l > 0 { n += 1 + l + sovDmmaster(uint64(l)) } return n } func (m *GetMasterCfgRequest) Size() (n int) { if m == nil { return 0 } var l int _ = l return n } func (m *GetMasterCfgResponse) Size() (n int) { if m == nil { return 0 } var l int _ = l l = len(m.Cfg) if l > 0 { n += 1 + l + sovDmmaster(uint64(l)) } return n } func (m *HandleErrorRequest) Size() (n int) { if m == nil { return 0 } var l int _ = l if m.Op != 0 { n += 1 + sovDmmaster(uint64(m.Op)) } l = len(m.Task) if l > 0 { n += 1 + l + sovDmmaster(uint64(l)) } if len(m.Sources) > 0 { for _, s := range m.Sources { l = len(s) n += 1 + l + sovDmmaster(uint64(l)) } } l = len(m.BinlogPos) if l > 0 { n += 1 + l + sovDmmaster(uint64(l)) } if len(m.Sqls) > 0 { for _, s := range m.Sqls { l = len(s) n += 1 + l + sovDmmaster(uint64(l)) } } return n } func (m *HandleErrorResponse) Size() (n int) { if m == nil { return 0 } var l int _ = l if m.Result { n += 2 } l = len(m.Msg) if l > 0 { n += 1 + l + sovDmmaster(uint64(l)) } if len(m.Sources) > 0 { for _, e := range m.Sources { l = e.Size() n += 1 + l + sovDmmaster(uint64(l)) } } return n } func (m *TransferSourceRequest) Size() (n int) { if m == nil { return 0 } var l int _ = l l = len(m.Source) if l > 0 { n += 1 + l + sovDmmaster(uint64(l)) } l = len(m.Worker) if l > 0 { n += 1 + l + sovDmmaster(uint64(l)) } return n } func (m *TransferSourceResponse) Size() (n int) { if m == nil { return 0 } var l int _ = l if m.Result { n += 2 } l = len(m.Msg) if l > 0 { n += 1 + l + sovDmmaster(uint64(l)) } return n } func (m *OperateRelayRequest) Size() (n int) { if m == nil { return 0 } var l int _ = l if m.Op != 0 { n += 1 + sovDmmaster(uint64(m.Op)) } l = len(m.Source) if l > 0 { n += 1 + l + sovDmmaster(uint64(l)) } if len(m.Worker) > 0 { for _, s := range m.Worker { l = len(s) n += 1 + l + sovDmmaster(uint64(l)) } } return n } func (m *OperateRelayResponse) Size() (n int) { if m == nil { return 0 } var l int _ = l if m.Result { n += 2 } l = len(m.Msg) if l > 0 { n += 1 + l + sovDmmaster(uint64(l)) } if len(m.Sources) > 0 { for _, e := range m.Sources { l = e.Size() n += 1 + l + sovDmmaster(uint64(l)) } } return n } func (m *StartValidationRequest) Size() (n int) { if m == nil { return 0 } var l int _ = l l = len(m.Mode) if l > 0 { n += 1 + l + sovDmmaster(uint64(l)) } l = len(m.FromTime) if l > 0 { n += 1 + l + sovDmmaster(uint64(l)) } if len(m.Sources) > 0 { for _, s := range m.Sources { l = len(s) n += 1 + l + sovDmmaster(uint64(l)) } } l = len(m.TaskName) if l > 0 { n += 1 + l + sovDmmaster(uint64(l)) } return n } func (m *StartValidationResponse) Size() (n int) { if m == nil { return 0 } var l int _ = l if m.Result { n += 2 } l = len(m.Msg) if l > 0 { n += 1 + l + sovDmmaster(uint64(l)) } if len(m.Sources) > 0 { for _, e := range m.Sources { l = e.Size() n += 1 + l + sovDmmaster(uint64(l)) } } return n } func (m *StopValidationRequest) Size() (n int) { if m == nil { return 0 } var l int _ = l if len(m.Sources) > 0 { for _, s := range m.Sources { l = len(s) n += 1 + l + sovDmmaster(uint64(l)) } } l = len(m.TaskName) if l > 0 { n += 1 + l + sovDmmaster(uint64(l)) } return n } func (m *StopValidationResponse) Size() (n int) { if m == nil { return 0 } var l int _ = l if m.Result { n += 2 } l = len(m.Msg) if l > 0 { n += 1 + l + sovDmmaster(uint64(l)) } if len(m.Sources) > 0 { for _, e := range m.Sources { l = e.Size() n += 1 + l + sovDmmaster(uint64(l)) } } return n } func sovDmmaster(x uint64) (n int) { return (math_bits.Len64(x|1) + 6) / 7 } func sozDmmaster(x uint64) (n int) { return sovDmmaster(uint64((x << 1) ^ uint64((int64(x) >> 63)))) } func (m *StartTaskRequest) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { preIndex := iNdEx var wire uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowDmmaster } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ wire |= uint64(b&0x7F) << shift if b < 0x80 { break } } fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { return fmt.Errorf("proto: StartTaskRequest: wiretype end group for non-group") } if fieldNum <= 0 { return fmt.Errorf("proto: StartTaskRequest: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Task", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowDmmaster } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ stringLen |= uint64(b&0x7F) << shift if b < 0x80 { break } } intStringLen := int(stringLen) if intStringLen < 0 { return ErrInvalidLengthDmmaster } postIndex := iNdEx + intStringLen if postIndex < 0 { return ErrInvalidLengthDmmaster } if postIndex > l { return io.ErrUnexpectedEOF } m.Task = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex case 2: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Sources", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowDmmaster } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ stringLen |= uint64(b&0x7F) << shift if b < 0x80 { break } } intStringLen := int(stringLen) if intStringLen < 0 { return ErrInvalidLengthDmmaster } postIndex := iNdEx + intStringLen if postIndex < 0 { return ErrInvalidLengthDmmaster } if postIndex > l { return io.ErrUnexpectedEOF } m.Sources = append(m.Sources, string(dAtA[iNdEx:postIndex])) iNdEx = postIndex case 3: if wireType != 0 { return fmt.Errorf("proto: wrong wireType = %d for field RemoveMeta", wireType) } var v int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowDmmaster } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ v |= int(b&0x7F) << shift if b < 0x80 { break } } m.RemoveMeta = bool(v != 0) case 4: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field StartTime", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowDmmaster } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ stringLen |= uint64(b&0x7F) << shift if b < 0x80 { break } } intStringLen := int(stringLen) if intStringLen < 0 { return ErrInvalidLengthDmmaster } postIndex := iNdEx + intStringLen if postIndex < 0 { return ErrInvalidLengthDmmaster } if postIndex > l { return io.ErrUnexpectedEOF } m.StartTime = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipDmmaster(dAtA[iNdEx:]) if err != nil { return err } if (skippy < 0) || (iNdEx+skippy) < 0 { return ErrInvalidLengthDmmaster } if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF } iNdEx += skippy } } if iNdEx > l { return io.ErrUnexpectedEOF } return nil } func (m *StartTaskResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { preIndex := iNdEx var wire uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowDmmaster } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ wire |= uint64(b&0x7F) << shift if b < 0x80 { break } } fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { return fmt.Errorf("proto: StartTaskResponse: wiretype end group for non-group") } if fieldNum <= 0 { return fmt.Errorf("proto: StartTaskResponse: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 0 { return fmt.Errorf("proto: wrong wireType = %d for field Result", wireType) } var v int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowDmmaster } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ v |= int(b&0x7F) << shift if b < 0x80 { break } } m.Result = bool(v != 0) case 2: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Msg", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowDmmaster } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ stringLen |= uint64(b&0x7F) << shift if b < 0x80 { break } } intStringLen := int(stringLen) if intStringLen < 0 { return ErrInvalidLengthDmmaster } postIndex := iNdEx + intStringLen if postIndex < 0 { return ErrInvalidLengthDmmaster } if postIndex > l { return io.ErrUnexpectedEOF } m.Msg = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex case 3: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Sources", wireType) } var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowDmmaster } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ msglen |= int(b&0x7F) << shift if b < 0x80 { break } } if msglen < 0 { return ErrInvalidLengthDmmaster } postIndex := iNdEx + msglen if postIndex < 0 { return ErrInvalidLengthDmmaster } if postIndex > l { return io.ErrUnexpectedEOF } m.Sources = append(m.Sources, &CommonWorkerResponse{}) if err := m.Sources[len(m.Sources)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex case 4: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field CheckResult", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowDmmaster } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ stringLen |= uint64(b&0x7F) << shift if b < 0x80 { break } } intStringLen := int(stringLen) if intStringLen < 0 { return ErrInvalidLengthDmmaster } postIndex := iNdEx + intStringLen if postIndex < 0 { return ErrInvalidLengthDmmaster } if postIndex > l { return io.ErrUnexpectedEOF } m.CheckResult = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipDmmaster(dAtA[iNdEx:]) if err != nil { return err } if (skippy < 0) || (iNdEx+skippy) < 0 { return ErrInvalidLengthDmmaster } if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF } iNdEx += skippy } } if iNdEx > l { return io.ErrUnexpectedEOF } return nil } func (m *OperateTaskRequest) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { preIndex := iNdEx var wire uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowDmmaster } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ wire |= uint64(b&0x7F) << shift if b < 0x80 { break } } fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { return fmt.Errorf("proto: OperateTaskRequest: wiretype end group for non-group") } if fieldNum <= 0 { return fmt.Errorf("proto: OperateTaskRequest: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 0 { return fmt.Errorf("proto: wrong wireType = %d for field Op", wireType) } m.Op = 0 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowDmmaster } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ m.Op |= TaskOp(b&0x7F) << shift if b < 0x80 { break } } case 2: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Name", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowDmmaster } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ stringLen |= uint64(b&0x7F) << shift if b < 0x80 { break } } intStringLen := int(stringLen) if intStringLen < 0 { return ErrInvalidLengthDmmaster } postIndex := iNdEx + intStringLen if postIndex < 0 { return ErrInvalidLengthDmmaster } if postIndex > l { return io.ErrUnexpectedEOF } m.Name = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex case 3: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Sources", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowDmmaster } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ stringLen |= uint64(b&0x7F) << shift if b < 0x80 { break } } intStringLen := int(stringLen) if intStringLen < 0 { return ErrInvalidLengthDmmaster } postIndex := iNdEx + intStringLen if postIndex < 0 { return ErrInvalidLengthDmmaster } if postIndex > l { return io.ErrUnexpectedEOF } m.Sources = append(m.Sources, string(dAtA[iNdEx:postIndex])) iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipDmmaster(dAtA[iNdEx:]) if err != nil { return err } if (skippy < 0) || (iNdEx+skippy) < 0 { return ErrInvalidLengthDmmaster } if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF } iNdEx += skippy } } if iNdEx > l { return io.ErrUnexpectedEOF } return nil } func (m *OperateTaskResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { preIndex := iNdEx var wire uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowDmmaster } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ wire |= uint64(b&0x7F) << shift if b < 0x80 { break } } fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { return fmt.Errorf("proto: OperateTaskResponse: wiretype end group for non-group") } if fieldNum <= 0 { return fmt.Errorf("proto: OperateTaskResponse: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 0 { return fmt.Errorf("proto: wrong wireType = %d for field Op", wireType) } m.Op = 0 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowDmmaster } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ m.Op |= TaskOp(b&0x7F) << shift if b < 0x80 { break } } case 2: if wireType != 0 { return fmt.Errorf("proto: wrong wireType = %d for field Result", wireType) } var v int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowDmmaster } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ v |= int(b&0x7F) << shift if b < 0x80 { break } } m.Result = bool(v != 0) case 3: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Msg", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowDmmaster } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ stringLen |= uint64(b&0x7F) << shift if b < 0x80 { break } } intStringLen := int(stringLen) if intStringLen < 0 { return ErrInvalidLengthDmmaster } postIndex := iNdEx + intStringLen if postIndex < 0 { return ErrInvalidLengthDmmaster } if postIndex > l { return io.ErrUnexpectedEOF } m.Msg = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex case 4: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Sources", wireType) } var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowDmmaster } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ msglen |= int(b&0x7F) << shift if b < 0x80 { break } } if msglen < 0 { return ErrInvalidLengthDmmaster } postIndex := iNdEx + msglen if postIndex < 0 { return ErrInvalidLengthDmmaster } if postIndex > l { return io.ErrUnexpectedEOF } m.Sources = append(m.Sources, &CommonWorkerResponse{}) if err := m.Sources[len(m.Sources)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipDmmaster(dAtA[iNdEx:]) if err != nil { return err } if (skippy < 0) || (iNdEx+skippy) < 0 { return ErrInvalidLengthDmmaster } if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF } iNdEx += skippy } } if iNdEx > l { return io.ErrUnexpectedEOF } return nil } func (m *UpdateTaskRequest) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { preIndex := iNdEx var wire uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowDmmaster } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ wire |= uint64(b&0x7F) << shift if b < 0x80 { break } } fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { return fmt.Errorf("proto: UpdateTaskRequest: wiretype end group for non-group") } if fieldNum <= 0 { return fmt.Errorf("proto: UpdateTaskRequest: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Task", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowDmmaster } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ stringLen |= uint64(b&0x7F) << shift if b < 0x80 { break } } intStringLen := int(stringLen) if intStringLen < 0 { return ErrInvalidLengthDmmaster } postIndex := iNdEx + intStringLen if postIndex < 0 { return ErrInvalidLengthDmmaster } if postIndex > l { return io.ErrUnexpectedEOF } m.Task = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex case 2: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Sources", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowDmmaster } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ stringLen |= uint64(b&0x7F) << shift if b < 0x80 { break } } intStringLen := int(stringLen) if intStringLen < 0 { return ErrInvalidLengthDmmaster } postIndex := iNdEx + intStringLen if postIndex < 0 { return ErrInvalidLengthDmmaster } if postIndex > l { return io.ErrUnexpectedEOF } m.Sources = append(m.Sources, string(dAtA[iNdEx:postIndex])) iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipDmmaster(dAtA[iNdEx:]) if err != nil { return err } if (skippy < 0) || (iNdEx+skippy) < 0 { return ErrInvalidLengthDmmaster } if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF } iNdEx += skippy } } if iNdEx > l { return io.ErrUnexpectedEOF } return nil } func (m *UpdateTaskResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { preIndex := iNdEx var wire uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowDmmaster } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ wire |= uint64(b&0x7F) << shift if b < 0x80 { break } } fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { return fmt.Errorf("proto: UpdateTaskResponse: wiretype end group for non-group") } if fieldNum <= 0 { return fmt.Errorf("proto: UpdateTaskResponse: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 0 { return fmt.Errorf("proto: wrong wireType = %d for field Result", wireType) } var v int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowDmmaster } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ v |= int(b&0x7F) << shift if b < 0x80 { break } } m.Result = bool(v != 0) case 2: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Msg", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowDmmaster } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ stringLen |= uint64(b&0x7F) << shift if b < 0x80 { break } } intStringLen := int(stringLen) if intStringLen < 0 { return ErrInvalidLengthDmmaster } postIndex := iNdEx + intStringLen if postIndex < 0 { return ErrInvalidLengthDmmaster } if postIndex > l { return io.ErrUnexpectedEOF } m.Msg = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex case 3: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Sources", wireType) } var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowDmmaster } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ msglen |= int(b&0x7F) << shift if b < 0x80 { break } } if msglen < 0 { return ErrInvalidLengthDmmaster } postIndex := iNdEx + msglen if postIndex < 0 { return ErrInvalidLengthDmmaster } if postIndex > l { return io.ErrUnexpectedEOF } m.Sources = append(m.Sources, &CommonWorkerResponse{}) if err := m.Sources[len(m.Sources)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex case 4: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field CheckResult", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowDmmaster } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ stringLen |= uint64(b&0x7F) << shift if b < 0x80 { break } } intStringLen := int(stringLen) if intStringLen < 0 { return ErrInvalidLengthDmmaster } postIndex := iNdEx + intStringLen if postIndex < 0 { return ErrInvalidLengthDmmaster } if postIndex > l { return io.ErrUnexpectedEOF } m.CheckResult = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipDmmaster(dAtA[iNdEx:]) if err != nil { return err } if (skippy < 0) || (iNdEx+skippy) < 0 { return ErrInvalidLengthDmmaster } if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF } iNdEx += skippy } } if iNdEx > l { return io.ErrUnexpectedEOF } return nil } func (m *QueryStatusListRequest) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { preIndex := iNdEx var wire uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowDmmaster } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ wire |= uint64(b&0x7F) << shift if b < 0x80 { break } } fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { return fmt.Errorf("proto: QueryStatusListRequest: wiretype end group for non-group") } if fieldNum <= 0 { return fmt.Errorf("proto: QueryStatusListRequest: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Name", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowDmmaster } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ stringLen |= uint64(b&0x7F) << shift if b < 0x80 { break } } intStringLen := int(stringLen) if intStringLen < 0 { return ErrInvalidLengthDmmaster } postIndex := iNdEx + intStringLen if postIndex < 0 { return ErrInvalidLengthDmmaster } if postIndex > l { return io.ErrUnexpectedEOF } m.Name = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex case 2: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Sources", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowDmmaster } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ stringLen |= uint64(b&0x7F) << shift if b < 0x80 { break } } intStringLen := int(stringLen) if intStringLen < 0 { return ErrInvalidLengthDmmaster } postIndex := iNdEx + intStringLen if postIndex < 0 { return ErrInvalidLengthDmmaster } if postIndex > l { return io.ErrUnexpectedEOF } m.Sources = append(m.Sources, string(dAtA[iNdEx:postIndex])) iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipDmmaster(dAtA[iNdEx:]) if err != nil { return err } if (skippy < 0) || (iNdEx+skippy) < 0 { return ErrInvalidLengthDmmaster } if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF } iNdEx += skippy } } if iNdEx > l { return io.ErrUnexpectedEOF } return nil } func (m *QueryStatusListResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { preIndex := iNdEx var wire uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowDmmaster } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ wire |= uint64(b&0x7F) << shift if b < 0x80 { break } } fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { return fmt.Errorf("proto: QueryStatusListResponse: wiretype end group for non-group") } if fieldNum <= 0 { return fmt.Errorf("proto: QueryStatusListResponse: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 0 { return fmt.Errorf("proto: wrong wireType = %d for field Result", wireType) } var v int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowDmmaster } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ v |= int(b&0x7F) << shift if b < 0x80 { break } } m.Result = bool(v != 0) case 2: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Msg", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowDmmaster } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ stringLen |= uint64(b&0x7F) << shift if b < 0x80 { break } } intStringLen := int(stringLen) if intStringLen < 0 { return ErrInvalidLengthDmmaster } postIndex := iNdEx + intStringLen if postIndex < 0 { return ErrInvalidLengthDmmaster } if postIndex > l { return io.ErrUnexpectedEOF } m.Msg = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex case 3: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Sources", wireType) } var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowDmmaster } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ msglen |= int(b&0x7F) << shift if b < 0x80 { break } } if msglen < 0 { return ErrInvalidLengthDmmaster } postIndex := iNdEx + msglen if postIndex < 0 { return ErrInvalidLengthDmmaster } if postIndex > l { return io.ErrUnexpectedEOF } m.Sources = append(m.Sources, &QueryStatusResponse{}) if err := m.Sources[len(m.Sources)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipDmmaster(dAtA[iNdEx:]) if err != nil { return err } if (skippy < 0) || (iNdEx+skippy) < 0 { return ErrInvalidLengthDmmaster } if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF } iNdEx += skippy } } if iNdEx > l { return io.ErrUnexpectedEOF } return nil } func (m *ShowDDLLocksRequest) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { preIndex := iNdEx var wire uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowDmmaster } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ wire |= uint64(b&0x7F) << shift if b < 0x80 { break } } fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { return fmt.Errorf("proto: ShowDDLLocksRequest: wiretype end group for non-group") } if fieldNum <= 0 { return fmt.Errorf("proto: ShowDDLLocksRequest: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Task", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowDmmaster } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ stringLen |= uint64(b&0x7F) << shift if b < 0x80 { break } } intStringLen := int(stringLen) if intStringLen < 0 { return ErrInvalidLengthDmmaster } postIndex := iNdEx + intStringLen if postIndex < 0 { return ErrInvalidLengthDmmaster } if postIndex > l { return io.ErrUnexpectedEOF } m.Task = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex case 2: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Sources", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowDmmaster } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ stringLen |= uint64(b&0x7F) << shift if b < 0x80 { break } } intStringLen := int(stringLen) if intStringLen < 0 { return ErrInvalidLengthDmmaster } postIndex := iNdEx + intStringLen if postIndex < 0 { return ErrInvalidLengthDmmaster } if postIndex > l { return io.ErrUnexpectedEOF } m.Sources = append(m.Sources, string(dAtA[iNdEx:postIndex])) iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipDmmaster(dAtA[iNdEx:]) if err != nil { return err } if (skippy < 0) || (iNdEx+skippy) < 0 { return ErrInvalidLengthDmmaster } if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF } iNdEx += skippy } } if iNdEx > l { return io.ErrUnexpectedEOF } return nil } func (m *DDLLock) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { preIndex := iNdEx var wire uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowDmmaster } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ wire |= uint64(b&0x7F) << shift if b < 0x80 { break } } fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { return fmt.Errorf("proto: DDLLock: wiretype end group for non-group") } if fieldNum <= 0 { return fmt.Errorf("proto: DDLLock: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field ID", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowDmmaster } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ stringLen |= uint64(b&0x7F) << shift if b < 0x80 { break } } intStringLen := int(stringLen) if intStringLen < 0 { return ErrInvalidLengthDmmaster } postIndex := iNdEx + intStringLen if postIndex < 0 { return ErrInvalidLengthDmmaster } if postIndex > l { return io.ErrUnexpectedEOF } m.ID = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex case 2: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Task", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowDmmaster } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ stringLen |= uint64(b&0x7F) << shift if b < 0x80 { break } } intStringLen := int(stringLen) if intStringLen < 0 { return ErrInvalidLengthDmmaster } postIndex := iNdEx + intStringLen if postIndex < 0 { return ErrInvalidLengthDmmaster } if postIndex > l { return io.ErrUnexpectedEOF } m.Task = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex case 3: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Mode", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowDmmaster } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ stringLen |= uint64(b&0x7F) << shift if b < 0x80 { break } } intStringLen := int(stringLen) if intStringLen < 0 { return ErrInvalidLengthDmmaster } postIndex := iNdEx + intStringLen if postIndex < 0 { return ErrInvalidLengthDmmaster } if postIndex > l { return io.ErrUnexpectedEOF } m.Mode = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex case 4: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Owner", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowDmmaster } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ stringLen |= uint64(b&0x7F) << shift if b < 0x80 { break } } intStringLen := int(stringLen) if intStringLen < 0 { return ErrInvalidLengthDmmaster } postIndex := iNdEx + intStringLen if postIndex < 0 { return ErrInvalidLengthDmmaster } if postIndex > l { return io.ErrUnexpectedEOF } m.Owner = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex case 5: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field DDLs", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowDmmaster } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ stringLen |= uint64(b&0x7F) << shift if b < 0x80 { break } } intStringLen := int(stringLen) if intStringLen < 0 { return ErrInvalidLengthDmmaster } postIndex := iNdEx + intStringLen if postIndex < 0 { return ErrInvalidLengthDmmaster } if postIndex > l { return io.ErrUnexpectedEOF } m.DDLs = append(m.DDLs, string(dAtA[iNdEx:postIndex])) iNdEx = postIndex case 6: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Synced", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowDmmaster } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ stringLen |= uint64(b&0x7F) << shift if b < 0x80 { break } } intStringLen := int(stringLen) if intStringLen < 0 { return ErrInvalidLengthDmmaster } postIndex := iNdEx + intStringLen if postIndex < 0 { return ErrInvalidLengthDmmaster } if postIndex > l { return io.ErrUnexpectedEOF } m.Synced = append(m.Synced, string(dAtA[iNdEx:postIndex])) iNdEx = postIndex case 7: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Unsynced", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowDmmaster } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ stringLen |= uint64(b&0x7F) << shift if b < 0x80 { break } } intStringLen := int(stringLen) if intStringLen < 0 { return ErrInvalidLengthDmmaster } postIndex := iNdEx + intStringLen if postIndex < 0 { return ErrInvalidLengthDmmaster } if postIndex > l { return io.ErrUnexpectedEOF } m.Unsynced = append(m.Unsynced, string(dAtA[iNdEx:postIndex])) iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipDmmaster(dAtA[iNdEx:]) if err != nil { return err } if (skippy < 0) || (iNdEx+skippy) < 0 { return ErrInvalidLengthDmmaster } if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF } iNdEx += skippy } } if iNdEx > l { return io.ErrUnexpectedEOF } return nil } func (m *ShowDDLLocksResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { preIndex := iNdEx var wire uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowDmmaster } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ wire |= uint64(b&0x7F) << shift if b < 0x80 { break } } fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { return fmt.Errorf("proto: ShowDDLLocksResponse: wiretype end group for non-group") } if fieldNum <= 0 { return fmt.Errorf("proto: ShowDDLLocksResponse: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 0 { return fmt.Errorf("proto: wrong wireType = %d for field Result", wireType) } var v int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowDmmaster } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ v |= int(b&0x7F) << shift if b < 0x80 { break } } m.Result = bool(v != 0) case 2: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Msg", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowDmmaster } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ stringLen |= uint64(b&0x7F) << shift if b < 0x80 { break } } intStringLen := int(stringLen) if intStringLen < 0 { return ErrInvalidLengthDmmaster } postIndex := iNdEx + intStringLen if postIndex < 0 { return ErrInvalidLengthDmmaster } if postIndex > l { return io.ErrUnexpectedEOF } m.Msg = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex case 3: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Locks", wireType) } var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowDmmaster } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ msglen |= int(b&0x7F) << shift if b < 0x80 { break } } if msglen < 0 { return ErrInvalidLengthDmmaster } postIndex := iNdEx + msglen if postIndex < 0 { return ErrInvalidLengthDmmaster } if postIndex > l { return io.ErrUnexpectedEOF } m.Locks = append(m.Locks, &DDLLock{}) if err := m.Locks[len(m.Locks)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipDmmaster(dAtA[iNdEx:]) if err != nil { return err } if (skippy < 0) || (iNdEx+skippy) < 0 { return ErrInvalidLengthDmmaster } if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF } iNdEx += skippy } } if iNdEx > l { return io.ErrUnexpectedEOF } return nil } func (m *UnlockDDLLockRequest) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { preIndex := iNdEx var wire uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowDmmaster } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ wire |= uint64(b&0x7F) << shift if b < 0x80 { break } } fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { return fmt.Errorf("proto: UnlockDDLLockRequest: wiretype end group for non-group") } if fieldNum <= 0 { return fmt.Errorf("proto: UnlockDDLLockRequest: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field ID", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowDmmaster } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ stringLen |= uint64(b&0x7F) << shift if b < 0x80 { break } } intStringLen := int(stringLen) if intStringLen < 0 { return ErrInvalidLengthDmmaster } postIndex := iNdEx + intStringLen if postIndex < 0 { return ErrInvalidLengthDmmaster } if postIndex > l { return io.ErrUnexpectedEOF } m.ID = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex case 2: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field ReplaceOwner", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowDmmaster } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ stringLen |= uint64(b&0x7F) << shift if b < 0x80 { break } } intStringLen := int(stringLen) if intStringLen < 0 { return ErrInvalidLengthDmmaster } postIndex := iNdEx + intStringLen if postIndex < 0 { return ErrInvalidLengthDmmaster } if postIndex > l { return io.ErrUnexpectedEOF } m.ReplaceOwner = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex case 3: if wireType != 0 { return fmt.Errorf("proto: wrong wireType = %d for field ForceRemove", wireType) } var v int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowDmmaster } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ v |= int(b&0x7F) << shift if b < 0x80 { break } } m.ForceRemove = bool(v != 0) case 4: if wireType != 0 { return fmt.Errorf("proto: wrong wireType = %d for field Op", wireType) } m.Op = 0 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowDmmaster } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ m.Op |= UnlockDDLLockOp(b&0x7F) << shift if b < 0x80 { break } } case 5: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Sources", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowDmmaster } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ stringLen |= uint64(b&0x7F) << shift if b < 0x80 { break } } intStringLen := int(stringLen) if intStringLen < 0 { return ErrInvalidLengthDmmaster } postIndex := iNdEx + intStringLen if postIndex < 0 { return ErrInvalidLengthDmmaster } if postIndex > l { return io.ErrUnexpectedEOF } m.Sources = append(m.Sources, string(dAtA[iNdEx:postIndex])) iNdEx = postIndex case 6: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Database", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowDmmaster } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ stringLen |= uint64(b&0x7F) << shift if b < 0x80 { break } } intStringLen := int(stringLen) if intStringLen < 0 { return ErrInvalidLengthDmmaster } postIndex := iNdEx + intStringLen if postIndex < 0 { return ErrInvalidLengthDmmaster } if postIndex > l { return io.ErrUnexpectedEOF } m.Database = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex case 7: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Table", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowDmmaster } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ stringLen |= uint64(b&0x7F) << shift if b < 0x80 { break } } intStringLen := int(stringLen) if intStringLen < 0 { return ErrInvalidLengthDmmaster } postIndex := iNdEx + intStringLen if postIndex < 0 { return ErrInvalidLengthDmmaster } if postIndex > l { return io.ErrUnexpectedEOF } m.Table = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipDmmaster(dAtA[iNdEx:]) if err != nil { return err } if (skippy < 0) || (iNdEx+skippy) < 0 { return ErrInvalidLengthDmmaster } if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF } iNdEx += skippy } } if iNdEx > l { return io.ErrUnexpectedEOF } return nil } func (m *UnlockDDLLockResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { preIndex := iNdEx var wire uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowDmmaster } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ wire |= uint64(b&0x7F) << shift if b < 0x80 { break } } fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { return fmt.Errorf("proto: UnlockDDLLockResponse: wiretype end group for non-group") } if fieldNum <= 0 { return fmt.Errorf("proto: UnlockDDLLockResponse: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 0 { return fmt.Errorf("proto: wrong wireType = %d for field Result", wireType) } var v int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowDmmaster } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ v |= int(b&0x7F) << shift if b < 0x80 { break } } m.Result = bool(v != 0) case 2: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Msg", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowDmmaster } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ stringLen |= uint64(b&0x7F) << shift if b < 0x80 { break } } intStringLen := int(stringLen) if intStringLen < 0 { return ErrInvalidLengthDmmaster } postIndex := iNdEx + intStringLen if postIndex < 0 { return ErrInvalidLengthDmmaster } if postIndex > l { return io.ErrUnexpectedEOF } m.Msg = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipDmmaster(dAtA[iNdEx:]) if err != nil { return err } if (skippy < 0) || (iNdEx+skippy) < 0 { return ErrInvalidLengthDmmaster } if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF } iNdEx += skippy } } if iNdEx > l { return io.ErrUnexpectedEOF } return nil } func (m *OperateWorkerRelayRequest) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { preIndex := iNdEx var wire uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowDmmaster } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ wire |= uint64(b&0x7F) << shift if b < 0x80 { break } } fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { return fmt.Errorf("proto: OperateWorkerRelayRequest: wiretype end group for non-group") } if fieldNum <= 0 { return fmt.Errorf("proto: OperateWorkerRelayRequest: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 0 { return fmt.Errorf("proto: wrong wireType = %d for field Op", wireType) } m.Op = 0 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowDmmaster } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ m.Op |= RelayOp(b&0x7F) << shift if b < 0x80 { break } } case 2: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Sources", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowDmmaster } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ stringLen |= uint64(b&0x7F) << shift if b < 0x80 { break } } intStringLen := int(stringLen) if intStringLen < 0 { return ErrInvalidLengthDmmaster } postIndex := iNdEx + intStringLen if postIndex < 0 { return ErrInvalidLengthDmmaster } if postIndex > l { return io.ErrUnexpectedEOF } m.Sources = append(m.Sources, string(dAtA[iNdEx:postIndex])) iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipDmmaster(dAtA[iNdEx:]) if err != nil { return err } if (skippy < 0) || (iNdEx+skippy) < 0 { return ErrInvalidLengthDmmaster } if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF } iNdEx += skippy } } if iNdEx > l { return io.ErrUnexpectedEOF } return nil } func (m *OperateWorkerRelayResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { preIndex := iNdEx var wire uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowDmmaster } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ wire |= uint64(b&0x7F) << shift if b < 0x80 { break } } fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { return fmt.Errorf("proto: OperateWorkerRelayResponse: wiretype end group for non-group") } if fieldNum <= 0 { return fmt.Errorf("proto: OperateWorkerRelayResponse: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 0 { return fmt.Errorf("proto: wrong wireType = %d for field Op", wireType) } m.Op = 0 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowDmmaster } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ m.Op |= RelayOp(b&0x7F) << shift if b < 0x80 { break } } case 2: if wireType != 0 { return fmt.Errorf("proto: wrong wireType = %d for field Result", wireType) } var v int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowDmmaster } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ v |= int(b&0x7F) << shift if b < 0x80 { break } } m.Result = bool(v != 0) case 3: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Msg", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowDmmaster } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ stringLen |= uint64(b&0x7F) << shift if b < 0x80 { break } } intStringLen := int(stringLen) if intStringLen < 0 { return ErrInvalidLengthDmmaster } postIndex := iNdEx + intStringLen if postIndex < 0 { return ErrInvalidLengthDmmaster } if postIndex > l { return io.ErrUnexpectedEOF } m.Msg = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex case 4: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Sources", wireType) } var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowDmmaster } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ msglen |= int(b&0x7F) << shift if b < 0x80 { break } } if msglen < 0 { return ErrInvalidLengthDmmaster } postIndex := iNdEx + msglen if postIndex < 0 { return ErrInvalidLengthDmmaster } if postIndex > l { return io.ErrUnexpectedEOF } m.Sources = append(m.Sources, &CommonWorkerResponse{}) if err := m.Sources[len(m.Sources)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipDmmaster(dAtA[iNdEx:]) if err != nil { return err } if (skippy < 0) || (iNdEx+skippy) < 0 { return ErrInvalidLengthDmmaster } if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF } iNdEx += skippy } } if iNdEx > l { return io.ErrUnexpectedEOF } return nil } func (m *PurgeWorkerRelayRequest) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { preIndex := iNdEx var wire uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowDmmaster } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ wire |= uint64(b&0x7F) << shift if b < 0x80 { break } } fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { return fmt.Errorf("proto: PurgeWorkerRelayRequest: wiretype end group for non-group") } if fieldNum <= 0 { return fmt.Errorf("proto: PurgeWorkerRelayRequest: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Sources", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowDmmaster } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ stringLen |= uint64(b&0x7F) << shift if b < 0x80 { break } } intStringLen := int(stringLen) if intStringLen < 0 { return ErrInvalidLengthDmmaster } postIndex := iNdEx + intStringLen if postIndex < 0 { return ErrInvalidLengthDmmaster } if postIndex > l { return io.ErrUnexpectedEOF } m.Sources = append(m.Sources, string(dAtA[iNdEx:postIndex])) iNdEx = postIndex case 2: if wireType != 0 { return fmt.Errorf("proto: wrong wireType = %d for field Inactive", wireType) } var v int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowDmmaster } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ v |= int(b&0x7F) << shift if b < 0x80 { break } } m.Inactive = bool(v != 0) case 3: if wireType != 0 { return fmt.Errorf("proto: wrong wireType = %d for field Time", wireType) } m.Time = 0 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowDmmaster } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ m.Time |= int64(b&0x7F) << shift if b < 0x80 { break } } case 4: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Filename", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowDmmaster } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ stringLen |= uint64(b&0x7F) << shift if b < 0x80 { break } } intStringLen := int(stringLen) if intStringLen < 0 { return ErrInvalidLengthDmmaster } postIndex := iNdEx + intStringLen if postIndex < 0 { return ErrInvalidLengthDmmaster } if postIndex > l { return io.ErrUnexpectedEOF } m.Filename = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex case 5: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field SubDir", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowDmmaster } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ stringLen |= uint64(b&0x7F) << shift if b < 0x80 { break } } intStringLen := int(stringLen) if intStringLen < 0 { return ErrInvalidLengthDmmaster } postIndex := iNdEx + intStringLen if postIndex < 0 { return ErrInvalidLengthDmmaster } if postIndex > l { return io.ErrUnexpectedEOF } m.SubDir = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipDmmaster(dAtA[iNdEx:]) if err != nil { return err } if (skippy < 0) || (iNdEx+skippy) < 0 { return ErrInvalidLengthDmmaster } if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF } iNdEx += skippy } } if iNdEx > l { return io.ErrUnexpectedEOF } return nil } func (m *PurgeWorkerRelayResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { preIndex := iNdEx var wire uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowDmmaster } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ wire |= uint64(b&0x7F) << shift if b < 0x80 { break } } fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { return fmt.Errorf("proto: PurgeWorkerRelayResponse: wiretype end group for non-group") } if fieldNum <= 0 { return fmt.Errorf("proto: PurgeWorkerRelayResponse: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 0 { return fmt.Errorf("proto: wrong wireType = %d for field Result", wireType) } var v int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowDmmaster } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ v |= int(b&0x7F) << shift if b < 0x80 { break } } m.Result = bool(v != 0) case 2: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Msg", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowDmmaster } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ stringLen |= uint64(b&0x7F) << shift if b < 0x80 { break } } intStringLen := int(stringLen) if intStringLen < 0 { return ErrInvalidLengthDmmaster } postIndex := iNdEx + intStringLen if postIndex < 0 { return ErrInvalidLengthDmmaster } if postIndex > l { return io.ErrUnexpectedEOF } m.Msg = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex case 3: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Sources", wireType) } var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowDmmaster } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ msglen |= int(b&0x7F) << shift if b < 0x80 { break } } if msglen < 0 { return ErrInvalidLengthDmmaster } postIndex := iNdEx + msglen if postIndex < 0 { return ErrInvalidLengthDmmaster } if postIndex > l { return io.ErrUnexpectedEOF } m.Sources = append(m.Sources, &CommonWorkerResponse{}) if err := m.Sources[len(m.Sources)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipDmmaster(dAtA[iNdEx:]) if err != nil { return err } if (skippy < 0) || (iNdEx+skippy) < 0 { return ErrInvalidLengthDmmaster } if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF } iNdEx += skippy } } if iNdEx > l { return io.ErrUnexpectedEOF } return nil } func (m *CheckTaskRequest) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { preIndex := iNdEx var wire uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowDmmaster } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ wire |= uint64(b&0x7F) << shift if b < 0x80 { break } } fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { return fmt.Errorf("proto: CheckTaskRequest: wiretype end group for non-group") } if fieldNum <= 0 { return fmt.Errorf("proto: CheckTaskRequest: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Task", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowDmmaster } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ stringLen |= uint64(b&0x7F) << shift if b < 0x80 { break } } intStringLen := int(stringLen) if intStringLen < 0 { return ErrInvalidLengthDmmaster } postIndex := iNdEx + intStringLen if postIndex < 0 { return ErrInvalidLengthDmmaster } if postIndex > l { return io.ErrUnexpectedEOF } m.Task = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex case 2: if wireType != 0 { return fmt.Errorf("proto: wrong wireType = %d for field ErrCnt", wireType) } m.ErrCnt = 0 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowDmmaster } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ m.ErrCnt |= int64(b&0x7F) << shift if b < 0x80 { break } } case 3: if wireType != 0 { return fmt.Errorf("proto: wrong wireType = %d for field WarnCnt", wireType) } m.WarnCnt = 0 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowDmmaster } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ m.WarnCnt |= int64(b&0x7F) << shift if b < 0x80 { break } } case 4: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field StartTime", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowDmmaster } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ stringLen |= uint64(b&0x7F) << shift if b < 0x80 { break } } intStringLen := int(stringLen) if intStringLen < 0 { return ErrInvalidLengthDmmaster } postIndex := iNdEx + intStringLen if postIndex < 0 { return ErrInvalidLengthDmmaster } if postIndex > l { return io.ErrUnexpectedEOF } m.StartTime = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipDmmaster(dAtA[iNdEx:]) if err != nil { return err } if (skippy < 0) || (iNdEx+skippy) < 0 { return ErrInvalidLengthDmmaster } if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF } iNdEx += skippy } } if iNdEx > l { return io.ErrUnexpectedEOF } return nil } func (m *CheckTaskResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { preIndex := iNdEx var wire uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowDmmaster } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ wire |= uint64(b&0x7F) << shift if b < 0x80 { break } } fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { return fmt.Errorf("proto: CheckTaskResponse: wiretype end group for non-group") } if fieldNum <= 0 { return fmt.Errorf("proto: CheckTaskResponse: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 0 { return fmt.Errorf("proto: wrong wireType = %d for field Result", wireType) } var v int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowDmmaster } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ v |= int(b&0x7F) << shift if b < 0x80 { break } } m.Result = bool(v != 0) case 2: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Msg", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowDmmaster } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ stringLen |= uint64(b&0x7F) << shift if b < 0x80 { break } } intStringLen := int(stringLen) if intStringLen < 0 { return ErrInvalidLengthDmmaster } postIndex := iNdEx + intStringLen if postIndex < 0 { return ErrInvalidLengthDmmaster } if postIndex > l { return io.ErrUnexpectedEOF } m.Msg = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipDmmaster(dAtA[iNdEx:]) if err != nil { return err } if (skippy < 0) || (iNdEx+skippy) < 0 { return ErrInvalidLengthDmmaster } if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF } iNdEx += skippy } } if iNdEx > l { return io.ErrUnexpectedEOF } return nil } func (m *OperateSourceRequest) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { preIndex := iNdEx var wire uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowDmmaster } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ wire |= uint64(b&0x7F) << shift if b < 0x80 { break } } fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { return fmt.Errorf("proto: OperateSourceRequest: wiretype end group for non-group") } if fieldNum <= 0 { return fmt.Errorf("proto: OperateSourceRequest: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 0 { return fmt.Errorf("proto: wrong wireType = %d for field Op", wireType) } m.Op = 0 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowDmmaster } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ m.Op |= SourceOp(b&0x7F) << shift if b < 0x80 { break } } case 2: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Config", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowDmmaster } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ stringLen |= uint64(b&0x7F) << shift if b < 0x80 { break } } intStringLen := int(stringLen) if intStringLen < 0 { return ErrInvalidLengthDmmaster } postIndex := iNdEx + intStringLen if postIndex < 0 { return ErrInvalidLengthDmmaster } if postIndex > l { return io.ErrUnexpectedEOF } m.Config = append(m.Config, string(dAtA[iNdEx:postIndex])) iNdEx = postIndex case 3: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field SourceID", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowDmmaster } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ stringLen |= uint64(b&0x7F) << shift if b < 0x80 { break } } intStringLen := int(stringLen) if intStringLen < 0 { return ErrInvalidLengthDmmaster } postIndex := iNdEx + intStringLen if postIndex < 0 { return ErrInvalidLengthDmmaster } if postIndex > l { return io.ErrUnexpectedEOF } m.SourceID = append(m.SourceID, string(dAtA[iNdEx:postIndex])) iNdEx = postIndex case 4: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field WorkerName", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowDmmaster } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ stringLen |= uint64(b&0x7F) << shift if b < 0x80 { break } } intStringLen := int(stringLen) if intStringLen < 0 { return ErrInvalidLengthDmmaster } postIndex := iNdEx + intStringLen if postIndex < 0 { return ErrInvalidLengthDmmaster } if postIndex > l { return io.ErrUnexpectedEOF } m.WorkerName = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipDmmaster(dAtA[iNdEx:]) if err != nil { return err } if (skippy < 0) || (iNdEx+skippy) < 0 { return ErrInvalidLengthDmmaster } if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF } iNdEx += skippy } } if iNdEx > l { return io.ErrUnexpectedEOF } return nil } func (m *OperateSourceResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { preIndex := iNdEx var wire uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowDmmaster } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ wire |= uint64(b&0x7F) << shift if b < 0x80 { break } } fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { return fmt.Errorf("proto: OperateSourceResponse: wiretype end group for non-group") } if fieldNum <= 0 { return fmt.Errorf("proto: OperateSourceResponse: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 0 { return fmt.Errorf("proto: wrong wireType = %d for field Result", wireType) } var v int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowDmmaster } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ v |= int(b&0x7F) << shift if b < 0x80 { break } } m.Result = bool(v != 0) case 2: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Msg", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowDmmaster } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ stringLen |= uint64(b&0x7F) << shift if b < 0x80 { break } } intStringLen := int(stringLen) if intStringLen < 0 { return ErrInvalidLengthDmmaster } postIndex := iNdEx + intStringLen if postIndex < 0 { return ErrInvalidLengthDmmaster } if postIndex > l { return io.ErrUnexpectedEOF } m.Msg = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex case 3: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Sources", wireType) } var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowDmmaster } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ msglen |= int(b&0x7F) << shift if b < 0x80 { break } } if msglen < 0 { return ErrInvalidLengthDmmaster } postIndex := iNdEx + msglen if postIndex < 0 { return ErrInvalidLengthDmmaster } if postIndex > l { return io.ErrUnexpectedEOF } m.Sources = append(m.Sources, &CommonWorkerResponse{}) if err := m.Sources[len(m.Sources)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipDmmaster(dAtA[iNdEx:]) if err != nil { return err } if (skippy < 0) || (iNdEx+skippy) < 0 { return ErrInvalidLengthDmmaster } if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF } iNdEx += skippy } } if iNdEx > l { return io.ErrUnexpectedEOF } return nil } func (m *RegisterWorkerRequest) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { preIndex := iNdEx var wire uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowDmmaster } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ wire |= uint64(b&0x7F) << shift if b < 0x80 { break } } fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { return fmt.Errorf("proto: RegisterWorkerRequest: wiretype end group for non-group") } if fieldNum <= 0 { return fmt.Errorf("proto: RegisterWorkerRequest: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Name", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowDmmaster } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ stringLen |= uint64(b&0x7F) << shift if b < 0x80 { break } } intStringLen := int(stringLen) if intStringLen < 0 { return ErrInvalidLengthDmmaster } postIndex := iNdEx + intStringLen if postIndex < 0 { return ErrInvalidLengthDmmaster } if postIndex > l { return io.ErrUnexpectedEOF } m.Name = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex case 2: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Address", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowDmmaster } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ stringLen |= uint64(b&0x7F) << shift if b < 0x80 { break } } intStringLen := int(stringLen) if intStringLen < 0 { return ErrInvalidLengthDmmaster } postIndex := iNdEx + intStringLen if postIndex < 0 { return ErrInvalidLengthDmmaster } if postIndex > l { return io.ErrUnexpectedEOF } m.Address = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipDmmaster(dAtA[iNdEx:]) if err != nil { return err } if (skippy < 0) || (iNdEx+skippy) < 0 { return ErrInvalidLengthDmmaster } if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF } iNdEx += skippy } } if iNdEx > l { return io.ErrUnexpectedEOF } return nil } func (m *RegisterWorkerResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { preIndex := iNdEx var wire uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowDmmaster } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ wire |= uint64(b&0x7F) << shift if b < 0x80 { break } } fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { return fmt.Errorf("proto: RegisterWorkerResponse: wiretype end group for non-group") } if fieldNum <= 0 { return fmt.Errorf("proto: RegisterWorkerResponse: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 0 { return fmt.Errorf("proto: wrong wireType = %d for field Result", wireType) } var v int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowDmmaster } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ v |= int(b&0x7F) << shift if b < 0x80 { break } } m.Result = bool(v != 0) case 2: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Msg", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowDmmaster } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ stringLen |= uint64(b&0x7F) << shift if b < 0x80 { break } } intStringLen := int(stringLen) if intStringLen < 0 { return ErrInvalidLengthDmmaster } postIndex := iNdEx + intStringLen if postIndex < 0 { return ErrInvalidLengthDmmaster } if postIndex > l { return io.ErrUnexpectedEOF } m.Msg = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipDmmaster(dAtA[iNdEx:]) if err != nil { return err } if (skippy < 0) || (iNdEx+skippy) < 0 { return ErrInvalidLengthDmmaster } if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF } iNdEx += skippy } } if iNdEx > l { return io.ErrUnexpectedEOF } return nil } func (m *OfflineMemberRequest) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { preIndex := iNdEx var wire uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowDmmaster } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ wire |= uint64(b&0x7F) << shift if b < 0x80 { break } } fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { return fmt.Errorf("proto: OfflineMemberRequest: wiretype end group for non-group") } if fieldNum <= 0 { return fmt.Errorf("proto: OfflineMemberRequest: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Type", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowDmmaster } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ stringLen |= uint64(b&0x7F) << shift if b < 0x80 { break } } intStringLen := int(stringLen) if intStringLen < 0 { return ErrInvalidLengthDmmaster } postIndex := iNdEx + intStringLen if postIndex < 0 { return ErrInvalidLengthDmmaster } if postIndex > l { return io.ErrUnexpectedEOF } m.Type = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex case 2: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Name", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowDmmaster } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ stringLen |= uint64(b&0x7F) << shift if b < 0x80 { break } } intStringLen := int(stringLen) if intStringLen < 0 { return ErrInvalidLengthDmmaster } postIndex := iNdEx + intStringLen if postIndex < 0 { return ErrInvalidLengthDmmaster } if postIndex > l { return io.ErrUnexpectedEOF } m.Name = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipDmmaster(dAtA[iNdEx:]) if err != nil { return err } if (skippy < 0) || (iNdEx+skippy) < 0 { return ErrInvalidLengthDmmaster } if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF } iNdEx += skippy } } if iNdEx > l { return io.ErrUnexpectedEOF } return nil } func (m *OfflineMemberResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { preIndex := iNdEx var wire uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowDmmaster } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ wire |= uint64(b&0x7F) << shift if b < 0x80 { break } } fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { return fmt.Errorf("proto: OfflineMemberResponse: wiretype end group for non-group") } if fieldNum <= 0 { return fmt.Errorf("proto: OfflineMemberResponse: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 0 { return fmt.Errorf("proto: wrong wireType = %d for field Result", wireType) } var v int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowDmmaster } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ v |= int(b&0x7F) << shift if b < 0x80 { break } } m.Result = bool(v != 0) case 2: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Msg", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowDmmaster } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ stringLen |= uint64(b&0x7F) << shift if b < 0x80 { break } } intStringLen := int(stringLen) if intStringLen < 0 { return ErrInvalidLengthDmmaster } postIndex := iNdEx + intStringLen if postIndex < 0 { return ErrInvalidLengthDmmaster } if postIndex > l { return io.ErrUnexpectedEOF } m.Msg = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipDmmaster(dAtA[iNdEx:]) if err != nil { return err } if (skippy < 0) || (iNdEx+skippy) < 0 { return ErrInvalidLengthDmmaster } if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF } iNdEx += skippy } } if iNdEx > l { return io.ErrUnexpectedEOF } return nil } func (m *OperateLeaderRequest) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { preIndex := iNdEx var wire uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowDmmaster } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ wire |= uint64(b&0x7F) << shift if b < 0x80 { break } } fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { return fmt.Errorf("proto: OperateLeaderRequest: wiretype end group for non-group") } if fieldNum <= 0 { return fmt.Errorf("proto: OperateLeaderRequest: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 0 { return fmt.Errorf("proto: wrong wireType = %d for field Op", wireType) } m.Op = 0 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowDmmaster } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ m.Op |= LeaderOp(b&0x7F) << shift if b < 0x80 { break } } default: iNdEx = preIndex skippy, err := skipDmmaster(dAtA[iNdEx:]) if err != nil { return err } if (skippy < 0) || (iNdEx+skippy) < 0 { return ErrInvalidLengthDmmaster } if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF } iNdEx += skippy } } if iNdEx > l { return io.ErrUnexpectedEOF } return nil } func (m *OperateLeaderResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { preIndex := iNdEx var wire uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowDmmaster } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ wire |= uint64(b&0x7F) << shift if b < 0x80 { break } } fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { return fmt.Errorf("proto: OperateLeaderResponse: wiretype end group for non-group") } if fieldNum <= 0 { return fmt.Errorf("proto: OperateLeaderResponse: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 0 { return fmt.Errorf("proto: wrong wireType = %d for field Result", wireType) } var v int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowDmmaster } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ v |= int(b&0x7F) << shift if b < 0x80 { break } } m.Result = bool(v != 0) case 2: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Msg", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowDmmaster } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ stringLen |= uint64(b&0x7F) << shift if b < 0x80 { break } } intStringLen := int(stringLen) if intStringLen < 0 { return ErrInvalidLengthDmmaster } postIndex := iNdEx + intStringLen if postIndex < 0 { return ErrInvalidLengthDmmaster } if postIndex > l { return io.ErrUnexpectedEOF } m.Msg = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipDmmaster(dAtA[iNdEx:]) if err != nil { return err } if (skippy < 0) || (iNdEx+skippy) < 0 { return ErrInvalidLengthDmmaster } if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF } iNdEx += skippy } } if iNdEx > l { return io.ErrUnexpectedEOF } return nil } func (m *MasterInfo) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { preIndex := iNdEx var wire uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowDmmaster } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ wire |= uint64(b&0x7F) << shift if b < 0x80 { break } } fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { return fmt.Errorf("proto: MasterInfo: wiretype end group for non-group") } if fieldNum <= 0 { return fmt.Errorf("proto: MasterInfo: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Name", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowDmmaster } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ stringLen |= uint64(b&0x7F) << shift if b < 0x80 { break } } intStringLen := int(stringLen) if intStringLen < 0 { return ErrInvalidLengthDmmaster } postIndex := iNdEx + intStringLen if postIndex < 0 { return ErrInvalidLengthDmmaster } if postIndex > l { return io.ErrUnexpectedEOF } m.Name = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex case 2: if wireType != 0 { return fmt.Errorf("proto: wrong wireType = %d for field MemberID", wireType) } m.MemberID = 0 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowDmmaster } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ m.MemberID |= uint64(b&0x7F) << shift if b < 0x80 { break } } case 3: if wireType != 0 { return fmt.Errorf("proto: wrong wireType = %d for field Alive", wireType) } var v int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowDmmaster } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ v |= int(b&0x7F) << shift if b < 0x80 { break } } m.Alive = bool(v != 0) case 4: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field PeerURLs", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowDmmaster } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ stringLen |= uint64(b&0x7F) << shift if b < 0x80 { break } } intStringLen := int(stringLen) if intStringLen < 0 { return ErrInvalidLengthDmmaster } postIndex := iNdEx + intStringLen if postIndex < 0 { return ErrInvalidLengthDmmaster } if postIndex > l { return io.ErrUnexpectedEOF } m.PeerURLs = append(m.PeerURLs, string(dAtA[iNdEx:postIndex])) iNdEx = postIndex case 5: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field ClientURLs", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowDmmaster } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ stringLen |= uint64(b&0x7F) << shift if b < 0x80 { break } } intStringLen := int(stringLen) if intStringLen < 0 { return ErrInvalidLengthDmmaster } postIndex := iNdEx + intStringLen if postIndex < 0 { return ErrInvalidLengthDmmaster } if postIndex > l { return io.ErrUnexpectedEOF } m.ClientURLs = append(m.ClientURLs, string(dAtA[iNdEx:postIndex])) iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipDmmaster(dAtA[iNdEx:]) if err != nil { return err } if (skippy < 0) || (iNdEx+skippy) < 0 { return ErrInvalidLengthDmmaster } if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF } iNdEx += skippy } } if iNdEx > l { return io.ErrUnexpectedEOF } return nil } func (m *WorkerInfo) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { preIndex := iNdEx var wire uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowDmmaster } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ wire |= uint64(b&0x7F) << shift if b < 0x80 { break } } fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { return fmt.Errorf("proto: WorkerInfo: wiretype end group for non-group") } if fieldNum <= 0 { return fmt.Errorf("proto: WorkerInfo: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Name", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowDmmaster } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ stringLen |= uint64(b&0x7F) << shift if b < 0x80 { break } } intStringLen := int(stringLen) if intStringLen < 0 { return ErrInvalidLengthDmmaster } postIndex := iNdEx + intStringLen if postIndex < 0 { return ErrInvalidLengthDmmaster } if postIndex > l { return io.ErrUnexpectedEOF } m.Name = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex case 2: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Addr", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowDmmaster } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ stringLen |= uint64(b&0x7F) << shift if b < 0x80 { break } } intStringLen := int(stringLen) if intStringLen < 0 { return ErrInvalidLengthDmmaster } postIndex := iNdEx + intStringLen if postIndex < 0 { return ErrInvalidLengthDmmaster } if postIndex > l { return io.ErrUnexpectedEOF } m.Addr = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex case 3: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Stage", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowDmmaster } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ stringLen |= uint64(b&0x7F) << shift if b < 0x80 { break } } intStringLen := int(stringLen) if intStringLen < 0 { return ErrInvalidLengthDmmaster } postIndex := iNdEx + intStringLen if postIndex < 0 { return ErrInvalidLengthDmmaster } if postIndex > l { return io.ErrUnexpectedEOF } m.Stage = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex case 4: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Source", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowDmmaster } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ stringLen |= uint64(b&0x7F) << shift if b < 0x80 { break } } intStringLen := int(stringLen) if intStringLen < 0 { return ErrInvalidLengthDmmaster } postIndex := iNdEx + intStringLen if postIndex < 0 { return ErrInvalidLengthDmmaster } if postIndex > l { return io.ErrUnexpectedEOF } m.Source = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipDmmaster(dAtA[iNdEx:]) if err != nil { return err } if (skippy < 0) || (iNdEx+skippy) < 0 { return ErrInvalidLengthDmmaster } if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF } iNdEx += skippy } } if iNdEx > l { return io.ErrUnexpectedEOF } return nil } func (m *ListLeaderMember) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { preIndex := iNdEx var wire uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowDmmaster } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ wire |= uint64(b&0x7F) << shift if b < 0x80 { break } } fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { return fmt.Errorf("proto: ListLeaderMember: wiretype end group for non-group") } if fieldNum <= 0 { return fmt.Errorf("proto: ListLeaderMember: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Msg", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowDmmaster } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ stringLen |= uint64(b&0x7F) << shift if b < 0x80 { break } } intStringLen := int(stringLen) if intStringLen < 0 { return ErrInvalidLengthDmmaster } postIndex := iNdEx + intStringLen if postIndex < 0 { return ErrInvalidLengthDmmaster } if postIndex > l { return io.ErrUnexpectedEOF } m.Msg = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex case 2: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Name", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowDmmaster } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ stringLen |= uint64(b&0x7F) << shift if b < 0x80 { break } } intStringLen := int(stringLen) if intStringLen < 0 { return ErrInvalidLengthDmmaster } postIndex := iNdEx + intStringLen if postIndex < 0 { return ErrInvalidLengthDmmaster } if postIndex > l { return io.ErrUnexpectedEOF } m.Name = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex case 3: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Addr", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowDmmaster } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ stringLen |= uint64(b&0x7F) << shift if b < 0x80 { break } } intStringLen := int(stringLen) if intStringLen < 0 { return ErrInvalidLengthDmmaster } postIndex := iNdEx + intStringLen if postIndex < 0 { return ErrInvalidLengthDmmaster } if postIndex > l { return io.ErrUnexpectedEOF } m.Addr = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipDmmaster(dAtA[iNdEx:]) if err != nil { return err } if (skippy < 0) || (iNdEx+skippy) < 0 { return ErrInvalidLengthDmmaster } if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF } iNdEx += skippy } } if iNdEx > l { return io.ErrUnexpectedEOF } return nil } func (m *ListMasterMember) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { preIndex := iNdEx var wire uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowDmmaster } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ wire |= uint64(b&0x7F) << shift if b < 0x80 { break } } fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { return fmt.Errorf("proto: ListMasterMember: wiretype end group for non-group") } if fieldNum <= 0 { return fmt.Errorf("proto: ListMasterMember: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Msg", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowDmmaster } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ stringLen |= uint64(b&0x7F) << shift if b < 0x80 { break } } intStringLen := int(stringLen) if intStringLen < 0 { return ErrInvalidLengthDmmaster } postIndex := iNdEx + intStringLen if postIndex < 0 { return ErrInvalidLengthDmmaster } if postIndex > l { return io.ErrUnexpectedEOF } m.Msg = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex case 2: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Masters", wireType) } var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowDmmaster } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ msglen |= int(b&0x7F) << shift if b < 0x80 { break } } if msglen < 0 { return ErrInvalidLengthDmmaster } postIndex := iNdEx + msglen if postIndex < 0 { return ErrInvalidLengthDmmaster } if postIndex > l { return io.ErrUnexpectedEOF } m.Masters = append(m.Masters, &MasterInfo{}) if err := m.Masters[len(m.Masters)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipDmmaster(dAtA[iNdEx:]) if err != nil { return err } if (skippy < 0) || (iNdEx+skippy) < 0 { return ErrInvalidLengthDmmaster } if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF } iNdEx += skippy } } if iNdEx > l { return io.ErrUnexpectedEOF } return nil } func (m *ListWorkerMember) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { preIndex := iNdEx var wire uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowDmmaster } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ wire |= uint64(b&0x7F) << shift if b < 0x80 { break } } fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { return fmt.Errorf("proto: ListWorkerMember: wiretype end group for non-group") } if fieldNum <= 0 { return fmt.Errorf("proto: ListWorkerMember: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Msg", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowDmmaster } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ stringLen |= uint64(b&0x7F) << shift if b < 0x80 { break } } intStringLen := int(stringLen) if intStringLen < 0 { return ErrInvalidLengthDmmaster } postIndex := iNdEx + intStringLen if postIndex < 0 { return ErrInvalidLengthDmmaster } if postIndex > l { return io.ErrUnexpectedEOF } m.Msg = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex case 2: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Workers", wireType) } var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowDmmaster } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ msglen |= int(b&0x7F) << shift if b < 0x80 { break } } if msglen < 0 { return ErrInvalidLengthDmmaster } postIndex := iNdEx + msglen if postIndex < 0 { return ErrInvalidLengthDmmaster } if postIndex > l { return io.ErrUnexpectedEOF } m.Workers = append(m.Workers, &WorkerInfo{}) if err := m.Workers[len(m.Workers)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipDmmaster(dAtA[iNdEx:]) if err != nil { return err } if (skippy < 0) || (iNdEx+skippy) < 0 { return ErrInvalidLengthDmmaster } if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF } iNdEx += skippy } } if iNdEx > l { return io.ErrUnexpectedEOF } return nil } func (m *Members) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { preIndex := iNdEx var wire uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowDmmaster } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ wire |= uint64(b&0x7F) << shift if b < 0x80 { break } } fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { return fmt.Errorf("proto: Members: wiretype end group for non-group") } if fieldNum <= 0 { return fmt.Errorf("proto: Members: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Leader", wireType) } var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowDmmaster } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ msglen |= int(b&0x7F) << shift if b < 0x80 { break } } if msglen < 0 { return ErrInvalidLengthDmmaster } postIndex := iNdEx + msglen if postIndex < 0 { return ErrInvalidLengthDmmaster } if postIndex > l { return io.ErrUnexpectedEOF } v := &ListLeaderMember{} if err := v.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } m.Member = &Members_Leader{v} iNdEx = postIndex case 2: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Master", wireType) } var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowDmmaster } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ msglen |= int(b&0x7F) << shift if b < 0x80 { break } } if msglen < 0 { return ErrInvalidLengthDmmaster } postIndex := iNdEx + msglen if postIndex < 0 { return ErrInvalidLengthDmmaster } if postIndex > l { return io.ErrUnexpectedEOF } v := &ListMasterMember{} if err := v.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } m.Member = &Members_Master{v} iNdEx = postIndex case 3: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Worker", wireType) } var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowDmmaster } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ msglen |= int(b&0x7F) << shift if b < 0x80 { break } } if msglen < 0 { return ErrInvalidLengthDmmaster } postIndex := iNdEx + msglen if postIndex < 0 { return ErrInvalidLengthDmmaster } if postIndex > l { return io.ErrUnexpectedEOF } v := &ListWorkerMember{} if err := v.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } m.Member = &Members_Worker{v} iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipDmmaster(dAtA[iNdEx:]) if err != nil { return err } if (skippy < 0) || (iNdEx+skippy) < 0 { return ErrInvalidLengthDmmaster } if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF } iNdEx += skippy } } if iNdEx > l { return io.ErrUnexpectedEOF } return nil } func (m *ListMemberRequest) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { preIndex := iNdEx var wire uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowDmmaster } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ wire |= uint64(b&0x7F) << shift if b < 0x80 { break } } fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { return fmt.Errorf("proto: ListMemberRequest: wiretype end group for non-group") } if fieldNum <= 0 { return fmt.Errorf("proto: ListMemberRequest: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 0 { return fmt.Errorf("proto: wrong wireType = %d for field Leader", wireType) } var v int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowDmmaster } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ v |= int(b&0x7F) << shift if b < 0x80 { break } } m.Leader = bool(v != 0) case 2: if wireType != 0 { return fmt.Errorf("proto: wrong wireType = %d for field Master", wireType) } var v int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowDmmaster } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ v |= int(b&0x7F) << shift if b < 0x80 { break } } m.Master = bool(v != 0) case 3: if wireType != 0 { return fmt.Errorf("proto: wrong wireType = %d for field Worker", wireType) } var v int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowDmmaster } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ v |= int(b&0x7F) << shift if b < 0x80 { break } } m.Worker = bool(v != 0) case 4: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Names", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowDmmaster } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ stringLen |= uint64(b&0x7F) << shift if b < 0x80 { break } } intStringLen := int(stringLen) if intStringLen < 0 { return ErrInvalidLengthDmmaster } postIndex := iNdEx + intStringLen if postIndex < 0 { return ErrInvalidLengthDmmaster } if postIndex > l { return io.ErrUnexpectedEOF } m.Names = append(m.Names, string(dAtA[iNdEx:postIndex])) iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipDmmaster(dAtA[iNdEx:]) if err != nil { return err } if (skippy < 0) || (iNdEx+skippy) < 0 { return ErrInvalidLengthDmmaster } if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF } iNdEx += skippy } } if iNdEx > l { return io.ErrUnexpectedEOF } return nil } func (m *ListMemberResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { preIndex := iNdEx var wire uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowDmmaster } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ wire |= uint64(b&0x7F) << shift if b < 0x80 { break } } fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { return fmt.Errorf("proto: ListMemberResponse: wiretype end group for non-group") } if fieldNum <= 0 { return fmt.Errorf("proto: ListMemberResponse: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 0 { return fmt.Errorf("proto: wrong wireType = %d for field Result", wireType) } var v int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowDmmaster } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ v |= int(b&0x7F) << shift if b < 0x80 { break } } m.Result = bool(v != 0) case 2: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Msg", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowDmmaster } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ stringLen |= uint64(b&0x7F) << shift if b < 0x80 { break } } intStringLen := int(stringLen) if intStringLen < 0 { return ErrInvalidLengthDmmaster } postIndex := iNdEx + intStringLen if postIndex < 0 { return ErrInvalidLengthDmmaster } if postIndex > l { return io.ErrUnexpectedEOF } m.Msg = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex case 3: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Members", wireType) } var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowDmmaster } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ msglen |= int(b&0x7F) << shift if b < 0x80 { break } } if msglen < 0 { return ErrInvalidLengthDmmaster } postIndex := iNdEx + msglen if postIndex < 0 { return ErrInvalidLengthDmmaster } if postIndex > l { return io.ErrUnexpectedEOF } m.Members = append(m.Members, &Members{}) if err := m.Members[len(m.Members)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipDmmaster(dAtA[iNdEx:]) if err != nil { return err } if (skippy < 0) || (iNdEx+skippy) < 0 { return ErrInvalidLengthDmmaster } if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF } iNdEx += skippy } } if iNdEx > l { return io.ErrUnexpectedEOF } return nil } func (m *OperateSchemaRequest) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { preIndex := iNdEx var wire uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowDmmaster } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ wire |= uint64(b&0x7F) << shift if b < 0x80 { break } } fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { return fmt.Errorf("proto: OperateSchemaRequest: wiretype end group for non-group") } if fieldNum <= 0 { return fmt.Errorf("proto: OperateSchemaRequest: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 0 { return fmt.Errorf("proto: wrong wireType = %d for field Op", wireType) } m.Op = 0 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowDmmaster } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ m.Op |= SchemaOp(b&0x7F) << shift if b < 0x80 { break } } case 2: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Task", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowDmmaster } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ stringLen |= uint64(b&0x7F) << shift if b < 0x80 { break } } intStringLen := int(stringLen) if intStringLen < 0 { return ErrInvalidLengthDmmaster } postIndex := iNdEx + intStringLen if postIndex < 0 { return ErrInvalidLengthDmmaster } if postIndex > l { return io.ErrUnexpectedEOF } m.Task = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex case 3: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Sources", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowDmmaster } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ stringLen |= uint64(b&0x7F) << shift if b < 0x80 { break } } intStringLen := int(stringLen) if intStringLen < 0 { return ErrInvalidLengthDmmaster } postIndex := iNdEx + intStringLen if postIndex < 0 { return ErrInvalidLengthDmmaster } if postIndex > l { return io.ErrUnexpectedEOF } m.Sources = append(m.Sources, string(dAtA[iNdEx:postIndex])) iNdEx = postIndex case 4: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Database", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowDmmaster } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ stringLen |= uint64(b&0x7F) << shift if b < 0x80 { break } } intStringLen := int(stringLen) if intStringLen < 0 { return ErrInvalidLengthDmmaster } postIndex := iNdEx + intStringLen if postIndex < 0 { return ErrInvalidLengthDmmaster } if postIndex > l { return io.ErrUnexpectedEOF } m.Database = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex case 5: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Table", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowDmmaster } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ stringLen |= uint64(b&0x7F) << shift if b < 0x80 { break } } intStringLen := int(stringLen) if intStringLen < 0 { return ErrInvalidLengthDmmaster } postIndex := iNdEx + intStringLen if postIndex < 0 { return ErrInvalidLengthDmmaster } if postIndex > l { return io.ErrUnexpectedEOF } m.Table = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex case 6: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Schema", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowDmmaster } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ stringLen |= uint64(b&0x7F) << shift if b < 0x80 { break } } intStringLen := int(stringLen) if intStringLen < 0 { return ErrInvalidLengthDmmaster } postIndex := iNdEx + intStringLen if postIndex < 0 { return ErrInvalidLengthDmmaster } if postIndex > l { return io.ErrUnexpectedEOF } m.Schema = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex case 7: if wireType != 0 { return fmt.Errorf("proto: wrong wireType = %d for field Flush", wireType) } var v int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowDmmaster } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ v |= int(b&0x7F) << shift if b < 0x80 { break } } m.Flush = bool(v != 0) case 8: if wireType != 0 { return fmt.Errorf("proto: wrong wireType = %d for field Sync", wireType) } var v int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowDmmaster } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ v |= int(b&0x7F) << shift if b < 0x80 { break } } m.Sync = bool(v != 0) case 9: if wireType != 0 { return fmt.Errorf("proto: wrong wireType = %d for field FromSource", wireType) } var v int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowDmmaster } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ v |= int(b&0x7F) << shift if b < 0x80 { break } } m.FromSource = bool(v != 0) case 10: if wireType != 0 { return fmt.Errorf("proto: wrong wireType = %d for field FromTarget", wireType) } var v int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowDmmaster } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ v |= int(b&0x7F) << shift if b < 0x80 { break } } m.FromTarget = bool(v != 0) default: iNdEx = preIndex skippy, err := skipDmmaster(dAtA[iNdEx:]) if err != nil { return err } if (skippy < 0) || (iNdEx+skippy) < 0 { return ErrInvalidLengthDmmaster } if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF } iNdEx += skippy } } if iNdEx > l { return io.ErrUnexpectedEOF } return nil } func (m *OperateSchemaResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { preIndex := iNdEx var wire uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowDmmaster } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ wire |= uint64(b&0x7F) << shift if b < 0x80 { break } } fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { return fmt.Errorf("proto: OperateSchemaResponse: wiretype end group for non-group") } if fieldNum <= 0 { return fmt.Errorf("proto: OperateSchemaResponse: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 0 { return fmt.Errorf("proto: wrong wireType = %d for field Result", wireType) } var v int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowDmmaster } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ v |= int(b&0x7F) << shift if b < 0x80 { break } } m.Result = bool(v != 0) case 2: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Msg", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowDmmaster } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ stringLen |= uint64(b&0x7F) << shift if b < 0x80 { break } } intStringLen := int(stringLen) if intStringLen < 0 { return ErrInvalidLengthDmmaster } postIndex := iNdEx + intStringLen if postIndex < 0 { return ErrInvalidLengthDmmaster } if postIndex > l { return io.ErrUnexpectedEOF } m.Msg = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex case 3: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Sources", wireType) } var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowDmmaster } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ msglen |= int(b&0x7F) << shift if b < 0x80 { break } } if msglen < 0 { return ErrInvalidLengthDmmaster } postIndex := iNdEx + msglen if postIndex < 0 { return ErrInvalidLengthDmmaster } if postIndex > l { return io.ErrUnexpectedEOF } m.Sources = append(m.Sources, &CommonWorkerResponse{}) if err := m.Sources[len(m.Sources)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipDmmaster(dAtA[iNdEx:]) if err != nil { return err } if (skippy < 0) || (iNdEx+skippy) < 0 { return ErrInvalidLengthDmmaster } if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF } iNdEx += skippy } } if iNdEx > l { return io.ErrUnexpectedEOF } return nil } func (m *GetSubTaskCfgRequest) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { preIndex := iNdEx var wire uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowDmmaster } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ wire |= uint64(b&0x7F) << shift if b < 0x80 { break } } fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { return fmt.Errorf("proto: GetSubTaskCfgRequest: wiretype end group for non-group") } if fieldNum <= 0 { return fmt.Errorf("proto: GetSubTaskCfgRequest: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Name", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowDmmaster } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ stringLen |= uint64(b&0x7F) << shift if b < 0x80 { break } } intStringLen := int(stringLen) if intStringLen < 0 { return ErrInvalidLengthDmmaster } postIndex := iNdEx + intStringLen if postIndex < 0 { return ErrInvalidLengthDmmaster } if postIndex > l { return io.ErrUnexpectedEOF } m.Name = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipDmmaster(dAtA[iNdEx:]) if err != nil { return err } if (skippy < 0) || (iNdEx+skippy) < 0 { return ErrInvalidLengthDmmaster } if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF } iNdEx += skippy } } if iNdEx > l { return io.ErrUnexpectedEOF } return nil } func (m *GetSubTaskCfgResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { preIndex := iNdEx var wire uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowDmmaster } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ wire |= uint64(b&0x7F) << shift if b < 0x80 { break } } fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { return fmt.Errorf("proto: GetSubTaskCfgResponse: wiretype end group for non-group") } if fieldNum <= 0 { return fmt.Errorf("proto: GetSubTaskCfgResponse: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 0 { return fmt.Errorf("proto: wrong wireType = %d for field Result", wireType) } var v int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowDmmaster } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ v |= int(b&0x7F) << shift if b < 0x80 { break } } m.Result = bool(v != 0) case 2: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Msg", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowDmmaster } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ stringLen |= uint64(b&0x7F) << shift if b < 0x80 { break } } intStringLen := int(stringLen) if intStringLen < 0 { return ErrInvalidLengthDmmaster } postIndex := iNdEx + intStringLen if postIndex < 0 { return ErrInvalidLengthDmmaster } if postIndex > l { return io.ErrUnexpectedEOF } m.Msg = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex case 3: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Cfgs", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowDmmaster } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ stringLen |= uint64(b&0x7F) << shift if b < 0x80 { break } } intStringLen := int(stringLen) if intStringLen < 0 { return ErrInvalidLengthDmmaster } postIndex := iNdEx + intStringLen if postIndex < 0 { return ErrInvalidLengthDmmaster } if postIndex > l { return io.ErrUnexpectedEOF } m.Cfgs = append(m.Cfgs, string(dAtA[iNdEx:postIndex])) iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipDmmaster(dAtA[iNdEx:]) if err != nil { return err } if (skippy < 0) || (iNdEx+skippy) < 0 { return ErrInvalidLengthDmmaster } if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF } iNdEx += skippy } } if iNdEx > l { return io.ErrUnexpectedEOF } return nil } func (m *GetCfgRequest) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { preIndex := iNdEx var wire uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowDmmaster } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ wire |= uint64(b&0x7F) << shift if b < 0x80 { break } } fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { return fmt.Errorf("proto: GetCfgRequest: wiretype end group for non-group") } if fieldNum <= 0 { return fmt.Errorf("proto: GetCfgRequest: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 0 { return fmt.Errorf("proto: wrong wireType = %d for field Type", wireType) } m.Type = 0 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowDmmaster } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ m.Type |= CfgType(b&0x7F) << shift if b < 0x80 { break } } case 2: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Name", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowDmmaster } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ stringLen |= uint64(b&0x7F) << shift if b < 0x80 { break } } intStringLen := int(stringLen) if intStringLen < 0 { return ErrInvalidLengthDmmaster } postIndex := iNdEx + intStringLen if postIndex < 0 { return ErrInvalidLengthDmmaster } if postIndex > l { return io.ErrUnexpectedEOF } m.Name = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipDmmaster(dAtA[iNdEx:]) if err != nil { return err } if (skippy < 0) || (iNdEx+skippy) < 0 { return ErrInvalidLengthDmmaster } if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF } iNdEx += skippy } } if iNdEx > l { return io.ErrUnexpectedEOF } return nil } func (m *GetCfgResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { preIndex := iNdEx var wire uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowDmmaster } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ wire |= uint64(b&0x7F) << shift if b < 0x80 { break } } fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { return fmt.Errorf("proto: GetCfgResponse: wiretype end group for non-group") } if fieldNum <= 0 { return fmt.Errorf("proto: GetCfgResponse: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 0 { return fmt.Errorf("proto: wrong wireType = %d for field Result", wireType) } var v int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowDmmaster } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ v |= int(b&0x7F) << shift if b < 0x80 { break } } m.Result = bool(v != 0) case 2: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Msg", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowDmmaster } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ stringLen |= uint64(b&0x7F) << shift if b < 0x80 { break } } intStringLen := int(stringLen) if intStringLen < 0 { return ErrInvalidLengthDmmaster } postIndex := iNdEx + intStringLen if postIndex < 0 { return ErrInvalidLengthDmmaster } if postIndex > l { return io.ErrUnexpectedEOF } m.Msg = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex case 3: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Cfg", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowDmmaster } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ stringLen |= uint64(b&0x7F) << shift if b < 0x80 { break } } intStringLen := int(stringLen) if intStringLen < 0 { return ErrInvalidLengthDmmaster } postIndex := iNdEx + intStringLen if postIndex < 0 { return ErrInvalidLengthDmmaster } if postIndex > l { return io.ErrUnexpectedEOF } m.Cfg = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipDmmaster(dAtA[iNdEx:]) if err != nil { return err } if (skippy < 0) || (iNdEx+skippy) < 0 { return ErrInvalidLengthDmmaster } if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF } iNdEx += skippy } } if iNdEx > l { return io.ErrUnexpectedEOF } return nil } func (m *GetMasterCfgRequest) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { preIndex := iNdEx var wire uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowDmmaster } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ wire |= uint64(b&0x7F) << shift if b < 0x80 { break } } fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { return fmt.Errorf("proto: GetMasterCfgRequest: wiretype end group for non-group") } if fieldNum <= 0 { return fmt.Errorf("proto: GetMasterCfgRequest: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { default: iNdEx = preIndex skippy, err := skipDmmaster(dAtA[iNdEx:]) if err != nil { return err } if (skippy < 0) || (iNdEx+skippy) < 0 { return ErrInvalidLengthDmmaster } if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF } iNdEx += skippy } } if iNdEx > l { return io.ErrUnexpectedEOF } return nil } func (m *GetMasterCfgResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { preIndex := iNdEx var wire uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowDmmaster } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ wire |= uint64(b&0x7F) << shift if b < 0x80 { break } } fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { return fmt.Errorf("proto: GetMasterCfgResponse: wiretype end group for non-group") } if fieldNum <= 0 { return fmt.Errorf("proto: GetMasterCfgResponse: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Cfg", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowDmmaster } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ stringLen |= uint64(b&0x7F) << shift if b < 0x80 { break } } intStringLen := int(stringLen) if intStringLen < 0 { return ErrInvalidLengthDmmaster } postIndex := iNdEx + intStringLen if postIndex < 0 { return ErrInvalidLengthDmmaster } if postIndex > l { return io.ErrUnexpectedEOF } m.Cfg = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipDmmaster(dAtA[iNdEx:]) if err != nil { return err } if (skippy < 0) || (iNdEx+skippy) < 0 { return ErrInvalidLengthDmmaster } if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF } iNdEx += skippy } } if iNdEx > l { return io.ErrUnexpectedEOF } return nil } func (m *HandleErrorRequest) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { preIndex := iNdEx var wire uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowDmmaster } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ wire |= uint64(b&0x7F) << shift if b < 0x80 { break } } fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { return fmt.Errorf("proto: HandleErrorRequest: wiretype end group for non-group") } if fieldNum <= 0 { return fmt.Errorf("proto: HandleErrorRequest: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 0 { return fmt.Errorf("proto: wrong wireType = %d for field Op", wireType) } m.Op = 0 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowDmmaster } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ m.Op |= ErrorOp(b&0x7F) << shift if b < 0x80 { break } } case 2: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Task", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowDmmaster } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ stringLen |= uint64(b&0x7F) << shift if b < 0x80 { break } } intStringLen := int(stringLen) if intStringLen < 0 { return ErrInvalidLengthDmmaster } postIndex := iNdEx + intStringLen if postIndex < 0 { return ErrInvalidLengthDmmaster } if postIndex > l { return io.ErrUnexpectedEOF } m.Task = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex case 3: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Sources", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowDmmaster } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ stringLen |= uint64(b&0x7F) << shift if b < 0x80 { break } } intStringLen := int(stringLen) if intStringLen < 0 { return ErrInvalidLengthDmmaster } postIndex := iNdEx + intStringLen if postIndex < 0 { return ErrInvalidLengthDmmaster } if postIndex > l { return io.ErrUnexpectedEOF } m.Sources = append(m.Sources, string(dAtA[iNdEx:postIndex])) iNdEx = postIndex case 4: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field BinlogPos", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowDmmaster } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ stringLen |= uint64(b&0x7F) << shift if b < 0x80 { break } } intStringLen := int(stringLen) if intStringLen < 0 { return ErrInvalidLengthDmmaster } postIndex := iNdEx + intStringLen if postIndex < 0 { return ErrInvalidLengthDmmaster } if postIndex > l { return io.ErrUnexpectedEOF } m.BinlogPos = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex case 5: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Sqls", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowDmmaster } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ stringLen |= uint64(b&0x7F) << shift if b < 0x80 { break } } intStringLen := int(stringLen) if intStringLen < 0 { return ErrInvalidLengthDmmaster } postIndex := iNdEx + intStringLen if postIndex < 0 { return ErrInvalidLengthDmmaster } if postIndex > l { return io.ErrUnexpectedEOF } m.Sqls = append(m.Sqls, string(dAtA[iNdEx:postIndex])) iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipDmmaster(dAtA[iNdEx:]) if err != nil { return err } if (skippy < 0) || (iNdEx+skippy) < 0 { return ErrInvalidLengthDmmaster } if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF } iNdEx += skippy } } if iNdEx > l { return io.ErrUnexpectedEOF } return nil } func (m *HandleErrorResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { preIndex := iNdEx var wire uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowDmmaster } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ wire |= uint64(b&0x7F) << shift if b < 0x80 { break } } fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { return fmt.Errorf("proto: HandleErrorResponse: wiretype end group for non-group") } if fieldNum <= 0 { return fmt.Errorf("proto: HandleErrorResponse: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 0 { return fmt.Errorf("proto: wrong wireType = %d for field Result", wireType) } var v int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowDmmaster } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ v |= int(b&0x7F) << shift if b < 0x80 { break } } m.Result = bool(v != 0) case 2: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Msg", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowDmmaster } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ stringLen |= uint64(b&0x7F) << shift if b < 0x80 { break } } intStringLen := int(stringLen) if intStringLen < 0 { return ErrInvalidLengthDmmaster } postIndex := iNdEx + intStringLen if postIndex < 0 { return ErrInvalidLengthDmmaster } if postIndex > l { return io.ErrUnexpectedEOF } m.Msg = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex case 3: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Sources", wireType) } var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowDmmaster } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ msglen |= int(b&0x7F) << shift if b < 0x80 { break } } if msglen < 0 { return ErrInvalidLengthDmmaster } postIndex := iNdEx + msglen if postIndex < 0 { return ErrInvalidLengthDmmaster } if postIndex > l { return io.ErrUnexpectedEOF } m.Sources = append(m.Sources, &CommonWorkerResponse{}) if err := m.Sources[len(m.Sources)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipDmmaster(dAtA[iNdEx:]) if err != nil { return err } if (skippy < 0) || (iNdEx+skippy) < 0 { return ErrInvalidLengthDmmaster } if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF } iNdEx += skippy } } if iNdEx > l { return io.ErrUnexpectedEOF } return nil } func (m *TransferSourceRequest) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { preIndex := iNdEx var wire uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowDmmaster } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ wire |= uint64(b&0x7F) << shift if b < 0x80 { break } } fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { return fmt.Errorf("proto: TransferSourceRequest: wiretype end group for non-group") } if fieldNum <= 0 { return fmt.Errorf("proto: TransferSourceRequest: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Source", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowDmmaster } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ stringLen |= uint64(b&0x7F) << shift if b < 0x80 { break } } intStringLen := int(stringLen) if intStringLen < 0 { return ErrInvalidLengthDmmaster } postIndex := iNdEx + intStringLen if postIndex < 0 { return ErrInvalidLengthDmmaster } if postIndex > l { return io.ErrUnexpectedEOF } m.Source = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex case 2: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Worker", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowDmmaster } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ stringLen |= uint64(b&0x7F) << shift if b < 0x80 { break } } intStringLen := int(stringLen) if intStringLen < 0 { return ErrInvalidLengthDmmaster } postIndex := iNdEx + intStringLen if postIndex < 0 { return ErrInvalidLengthDmmaster } if postIndex > l { return io.ErrUnexpectedEOF } m.Worker = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipDmmaster(dAtA[iNdEx:]) if err != nil { return err } if (skippy < 0) || (iNdEx+skippy) < 0 { return ErrInvalidLengthDmmaster } if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF } iNdEx += skippy } } if iNdEx > l { return io.ErrUnexpectedEOF } return nil } func (m *TransferSourceResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { preIndex := iNdEx var wire uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowDmmaster } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ wire |= uint64(b&0x7F) << shift if b < 0x80 { break } } fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { return fmt.Errorf("proto: TransferSourceResponse: wiretype end group for non-group") } if fieldNum <= 0 { return fmt.Errorf("proto: TransferSourceResponse: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 0 { return fmt.Errorf("proto: wrong wireType = %d for field Result", wireType) } var v int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowDmmaster } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ v |= int(b&0x7F) << shift if b < 0x80 { break } } m.Result = bool(v != 0) case 2: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Msg", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowDmmaster } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ stringLen |= uint64(b&0x7F) << shift if b < 0x80 { break } } intStringLen := int(stringLen) if intStringLen < 0 { return ErrInvalidLengthDmmaster } postIndex := iNdEx + intStringLen if postIndex < 0 { return ErrInvalidLengthDmmaster } if postIndex > l { return io.ErrUnexpectedEOF } m.Msg = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipDmmaster(dAtA[iNdEx:]) if err != nil { return err } if (skippy < 0) || (iNdEx+skippy) < 0 { return ErrInvalidLengthDmmaster } if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF } iNdEx += skippy } } if iNdEx > l { return io.ErrUnexpectedEOF } return nil } func (m *OperateRelayRequest) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { preIndex := iNdEx var wire uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowDmmaster } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ wire |= uint64(b&0x7F) << shift if b < 0x80 { break } } fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { return fmt.Errorf("proto: OperateRelayRequest: wiretype end group for non-group") } if fieldNum <= 0 { return fmt.Errorf("proto: OperateRelayRequest: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 0 { return fmt.Errorf("proto: wrong wireType = %d for field Op", wireType) } m.Op = 0 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowDmmaster } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ m.Op |= RelayOpV2(b&0x7F) << shift if b < 0x80 { break } } case 2: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Source", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowDmmaster } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ stringLen |= uint64(b&0x7F) << shift if b < 0x80 { break } } intStringLen := int(stringLen) if intStringLen < 0 { return ErrInvalidLengthDmmaster } postIndex := iNdEx + intStringLen if postIndex < 0 { return ErrInvalidLengthDmmaster } if postIndex > l { return io.ErrUnexpectedEOF } m.Source = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex case 3: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Worker", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowDmmaster } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ stringLen |= uint64(b&0x7F) << shift if b < 0x80 { break } } intStringLen := int(stringLen) if intStringLen < 0 { return ErrInvalidLengthDmmaster } postIndex := iNdEx + intStringLen if postIndex < 0 { return ErrInvalidLengthDmmaster } if postIndex > l { return io.ErrUnexpectedEOF } m.Worker = append(m.Worker, string(dAtA[iNdEx:postIndex])) iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipDmmaster(dAtA[iNdEx:]) if err != nil { return err } if (skippy < 0) || (iNdEx+skippy) < 0 { return ErrInvalidLengthDmmaster } if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF } iNdEx += skippy } } if iNdEx > l { return io.ErrUnexpectedEOF } return nil } func (m *OperateRelayResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { preIndex := iNdEx var wire uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowDmmaster } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ wire |= uint64(b&0x7F) << shift if b < 0x80 { break } } fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { return fmt.Errorf("proto: OperateRelayResponse: wiretype end group for non-group") } if fieldNum <= 0 { return fmt.Errorf("proto: OperateRelayResponse: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 0 { return fmt.Errorf("proto: wrong wireType = %d for field Result", wireType) } var v int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowDmmaster } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ v |= int(b&0x7F) << shift if b < 0x80 { break } } m.Result = bool(v != 0) case 2: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Msg", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowDmmaster } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ stringLen |= uint64(b&0x7F) << shift if b < 0x80 { break } } intStringLen := int(stringLen) if intStringLen < 0 { return ErrInvalidLengthDmmaster } postIndex := iNdEx + intStringLen if postIndex < 0 { return ErrInvalidLengthDmmaster } if postIndex > l { return io.ErrUnexpectedEOF } m.Msg = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex case 3: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Sources", wireType) } var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowDmmaster } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ msglen |= int(b&0x7F) << shift if b < 0x80 { break } } if msglen < 0 { return ErrInvalidLengthDmmaster } postIndex := iNdEx + msglen if postIndex < 0 { return ErrInvalidLengthDmmaster } if postIndex > l { return io.ErrUnexpectedEOF } m.Sources = append(m.Sources, &CommonWorkerResponse{}) if err := m.Sources[len(m.Sources)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipDmmaster(dAtA[iNdEx:]) if err != nil { return err } if (skippy < 0) || (iNdEx+skippy) < 0 { return ErrInvalidLengthDmmaster } if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF } iNdEx += skippy } } if iNdEx > l { return io.ErrUnexpectedEOF } return nil } func (m *StartValidationRequest) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { preIndex := iNdEx var wire uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowDmmaster } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ wire |= uint64(b&0x7F) << shift if b < 0x80 { break } } fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { return fmt.Errorf("proto: StartValidationRequest: wiretype end group for non-group") } if fieldNum <= 0 { return fmt.Errorf("proto: StartValidationRequest: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Mode", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowDmmaster } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ stringLen |= uint64(b&0x7F) << shift if b < 0x80 { break } } intStringLen := int(stringLen) if intStringLen < 0 { return ErrInvalidLengthDmmaster } postIndex := iNdEx + intStringLen if postIndex < 0 { return ErrInvalidLengthDmmaster } if postIndex > l { return io.ErrUnexpectedEOF } m.Mode = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex case 2: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field FromTime", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowDmmaster } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ stringLen |= uint64(b&0x7F) << shift if b < 0x80 { break } } intStringLen := int(stringLen) if intStringLen < 0 { return ErrInvalidLengthDmmaster } postIndex := iNdEx + intStringLen if postIndex < 0 { return ErrInvalidLengthDmmaster } if postIndex > l { return io.ErrUnexpectedEOF } m.FromTime = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex case 3: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Sources", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowDmmaster } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ stringLen |= uint64(b&0x7F) << shift if b < 0x80 { break } } intStringLen := int(stringLen) if intStringLen < 0 { return ErrInvalidLengthDmmaster } postIndex := iNdEx + intStringLen if postIndex < 0 { return ErrInvalidLengthDmmaster } if postIndex > l { return io.ErrUnexpectedEOF } m.Sources = append(m.Sources, string(dAtA[iNdEx:postIndex])) iNdEx = postIndex case 4: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field TaskName", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowDmmaster } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ stringLen |= uint64(b&0x7F) << shift if b < 0x80 { break } } intStringLen := int(stringLen) if intStringLen < 0 { return ErrInvalidLengthDmmaster } postIndex := iNdEx + intStringLen if postIndex < 0 { return ErrInvalidLengthDmmaster } if postIndex > l { return io.ErrUnexpectedEOF } m.TaskName = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipDmmaster(dAtA[iNdEx:]) if err != nil { return err } if (skippy < 0) || (iNdEx+skippy) < 0 { return ErrInvalidLengthDmmaster } if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF } iNdEx += skippy } } if iNdEx > l { return io.ErrUnexpectedEOF } return nil } func (m *StartValidationResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { preIndex := iNdEx var wire uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowDmmaster } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ wire |= uint64(b&0x7F) << shift if b < 0x80 { break } } fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { return fmt.Errorf("proto: StartValidationResponse: wiretype end group for non-group") } if fieldNum <= 0 { return fmt.Errorf("proto: StartValidationResponse: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 0 { return fmt.Errorf("proto: wrong wireType = %d for field Result", wireType) } var v int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowDmmaster } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ v |= int(b&0x7F) << shift if b < 0x80 { break } } m.Result = bool(v != 0) case 2: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Msg", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowDmmaster } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ stringLen |= uint64(b&0x7F) << shift if b < 0x80 { break } } intStringLen := int(stringLen) if intStringLen < 0 { return ErrInvalidLengthDmmaster } postIndex := iNdEx + intStringLen if postIndex < 0 { return ErrInvalidLengthDmmaster } if postIndex > l { return io.ErrUnexpectedEOF } m.Msg = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex case 3: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Sources", wireType) } var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowDmmaster } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ msglen |= int(b&0x7F) << shift if b < 0x80 { break } } if msglen < 0 { return ErrInvalidLengthDmmaster } postIndex := iNdEx + msglen if postIndex < 0 { return ErrInvalidLengthDmmaster } if postIndex > l { return io.ErrUnexpectedEOF } m.Sources = append(m.Sources, &CommonWorkerResponse{}) if err := m.Sources[len(m.Sources)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipDmmaster(dAtA[iNdEx:]) if err != nil { return err } if (skippy < 0) || (iNdEx+skippy) < 0 { return ErrInvalidLengthDmmaster } if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF } iNdEx += skippy } } if iNdEx > l { return io.ErrUnexpectedEOF } return nil } func (m *StopValidationRequest) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { preIndex := iNdEx var wire uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowDmmaster } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ wire |= uint64(b&0x7F) << shift if b < 0x80 { break } } fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { return fmt.Errorf("proto: StopValidationRequest: wiretype end group for non-group") } if fieldNum <= 0 { return fmt.Errorf("proto: StopValidationRequest: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Sources", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowDmmaster } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ stringLen |= uint64(b&0x7F) << shift if b < 0x80 { break } } intStringLen := int(stringLen) if intStringLen < 0 { return ErrInvalidLengthDmmaster } postIndex := iNdEx + intStringLen if postIndex < 0 { return ErrInvalidLengthDmmaster } if postIndex > l { return io.ErrUnexpectedEOF } m.Sources = append(m.Sources, string(dAtA[iNdEx:postIndex])) iNdEx = postIndex case 2: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field TaskName", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowDmmaster } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ stringLen |= uint64(b&0x7F) << shift if b < 0x80 { break } } intStringLen := int(stringLen) if intStringLen < 0 { return ErrInvalidLengthDmmaster } postIndex := iNdEx + intStringLen if postIndex < 0 { return ErrInvalidLengthDmmaster } if postIndex > l { return io.ErrUnexpectedEOF } m.TaskName = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipDmmaster(dAtA[iNdEx:]) if err != nil { return err } if (skippy < 0) || (iNdEx+skippy) < 0 { return ErrInvalidLengthDmmaster } if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF } iNdEx += skippy } } if iNdEx > l { return io.ErrUnexpectedEOF } return nil } func (m *StopValidationResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { preIndex := iNdEx var wire uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowDmmaster } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ wire |= uint64(b&0x7F) << shift if b < 0x80 { break } } fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { return fmt.Errorf("proto: StopValidationResponse: wiretype end group for non-group") } if fieldNum <= 0 { return fmt.Errorf("proto: StopValidationResponse: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 0 { return fmt.Errorf("proto: wrong wireType = %d for field Result", wireType) } var v int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowDmmaster } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ v |= int(b&0x7F) << shift if b < 0x80 { break } } m.Result = bool(v != 0) case 2: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Msg", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowDmmaster } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ stringLen |= uint64(b&0x7F) << shift if b < 0x80 { break } } intStringLen := int(stringLen) if intStringLen < 0 { return ErrInvalidLengthDmmaster } postIndex := iNdEx + intStringLen if postIndex < 0 { return ErrInvalidLengthDmmaster } if postIndex > l { return io.ErrUnexpectedEOF } m.Msg = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex case 3: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Sources", wireType) } var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowDmmaster } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ msglen |= int(b&0x7F) << shift if b < 0x80 { break } } if msglen < 0 { return ErrInvalidLengthDmmaster } postIndex := iNdEx + msglen if postIndex < 0 { return ErrInvalidLengthDmmaster } if postIndex > l { return io.ErrUnexpectedEOF } m.Sources = append(m.Sources, &CommonWorkerResponse{}) if err := m.Sources[len(m.Sources)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipDmmaster(dAtA[iNdEx:]) if err != nil { return err } if (skippy < 0) || (iNdEx+skippy) < 0 { return ErrInvalidLengthDmmaster } if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF } iNdEx += skippy } } if iNdEx > l { return io.ErrUnexpectedEOF } return nil } func skipDmmaster(dAtA []byte) (n int, err error) { l := len(dAtA) iNdEx := 0 depth := 0 for iNdEx < l { var wire uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return 0, ErrIntOverflowDmmaster } if iNdEx >= l { return 0, io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ wire |= (uint64(b) & 0x7F) << shift if b < 0x80 { break } } wireType := int(wire & 0x7) switch wireType { case 0: for shift := uint(0); ; shift += 7 { if shift >= 64 { return 0, ErrIntOverflowDmmaster } if iNdEx >= l { return 0, io.ErrUnexpectedEOF } iNdEx++ if dAtA[iNdEx-1] < 0x80 { break } } case 1: iNdEx += 8 case 2: var length int for shift := uint(0); ; shift += 7 { if shift >= 64 { return 0, ErrIntOverflowDmmaster } if iNdEx >= l { return 0, io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ length |= (int(b) & 0x7F) << shift if b < 0x80 { break } } if length < 0 { return 0, ErrInvalidLengthDmmaster } iNdEx += length case 3: depth++ case 4: if depth == 0 { return 0, ErrUnexpectedEndOfGroupDmmaster } depth-- case 5: iNdEx += 4 default: return 0, fmt.Errorf("proto: illegal wireType %d", wireType) } if iNdEx < 0 { return 0, ErrInvalidLengthDmmaster } if depth == 0 { return iNdEx, nil } } return 0, io.ErrUnexpectedEOF } var ( ErrInvalidLengthDmmaster = fmt.Errorf("proto: negative length found during unmarshaling") ErrIntOverflowDmmaster = fmt.Errorf("proto: integer overflow") ErrUnexpectedEndOfGroupDmmaster = fmt.Errorf("proto: unexpected end of group") )
eoekun/jsondoc
jsondoc-core/src/test/java/org/jsondoc/core/util/JSONDocEnumTemplateBuilderTest.java
package org.jsondoc.core.util; import java.io.IOException; import java.util.Map; import java.util.Set; import org.jsondoc.core.util.pojo.MyEnum; import org.junit.Test; import com.fasterxml.jackson.databind.ObjectMapper; import com.google.common.collect.Sets; public class JSONDocEnumTemplateBuilderTest { @Test public void testTemplate() throws IOException, IllegalArgumentException, IllegalAccessException, InstantiationException { ObjectMapper mapper = new ObjectMapper(); Set<Class<?>> classes = Sets.<Class<?>>newHashSet(MyEnum.class); Map<String, Object> template = JSONDocTemplateBuilder.build(MyEnum.class, classes); System.out.println(mapper.writeValueAsString(template)); } }
SamirAroudj/BaseProject
Platform/Utilities/RectanglePacker.cpp
<gh_stars>0 /* * Copyright (C) 2017 by Author: Aroudj, Samir, born in Suhl, Thueringen, Germany * All rights reserved. * * This software may be modified and distributed under the terms * of the BSD 3-Clause license. See the License.txt file for details. */ #include <cstring> #include <limits> #include "RectanglePacker.h" using namespace Utilities; using namespace std; bool RectanglePacker::packRectangles(int32 binWidth, int32 binHeight, int32 numRectangles, RectangleSize *sizes, RectangleCoords *coords) { size_t bestMaxRectIndex = -1; size_t bestRectIndex = -1; memset(coords, -1, numRectangles * 2 * sizeof(int32)); //no known coords, 1 max rect which entirely occupies the bin mMaxRects.push_back(BoundingBox(0, 0, binWidth, binHeight)); for (int32 numPlacedRectangles = 0; numPlacedRectangles < numRectangles; ++numPlacedRectangles) // find a position for each rectangle { findBestChoice(numRectangles, sizes, coords, bestMaxRectIndex, bestRectIndex); if ((-1 == bestMaxRectIndex) || (-1 == bestRectIndex)) return false; BoundingBox usedSpace = placeRectIntoBin(sizes, coords, bestMaxRectIndex, bestRectIndex); subdivideMaxRects(usedSpace); processPendingRects(); } return true; } void RectanglePacker::findBestChoice(int32 numRectangles, RectangleSize *sizes, RectangleCoords *coords, size_t &bestMaxRectIndex, size_t &bestRectIndex) { size_t numMaxRects = mMaxRects.size(); int32 bestValue = numeric_limits<int>::max(); // smallest min(maxRectW - rectW, maxRectH - rectH) bestMaxRectIndex = -1; bestRectIndex = -1; for (int32 rectCounter = 0; rectCounter < numRectangles; ++rectCounter) { RectangleCoords position = coords[rectCounter]; // was the rectangle already placed? if (position.mX != -1) continue; RectangleSize rectSize = sizes[rectCounter]; // check this rect for (size_t maxRectCounter = 0; maxRectCounter < numMaxRects; ++maxRectCounter) { BoundingBox maxRect = mMaxRects[maxRectCounter]; int32 diffWidth = maxRect.mWidth - rectSize.mWidth; // better value than best value? int32 diffHeight = maxRect.mHeight - rectSize.mHeight; int32 shorterDiff = (diffWidth < diffHeight ? diffWidth : diffHeight); if ((shorterDiff < 0) || (shorterDiff >= bestValue)) continue; bestValue = shorterDiff; // new best choice bestMaxRectIndex = maxRectCounter; bestRectIndex = rectCounter; } } } BoundingBox RectanglePacker::placeRectIntoBin(RectangleSize *sizes, RectangleCoords *coords, size_t bestMaxRectIndex, size_t bestRectIndex) { BoundingBox chosenMaxRect = mMaxRects[bestMaxRectIndex]; // get and remove chosen max rect mMaxRects[bestMaxRectIndex] = mMaxRects.back(); mMaxRects.pop_back(); RectangleSize rect = sizes[bestRectIndex]; // add rects for remaining space of used max rect int32 diffWidth = chosenMaxRect.mWidth - rect.mWidth; // new max rect on the right side of the placed rect if (diffWidth > 0) { mPendingRects.push_back(BoundingBox(chosenMaxRect.mX + rect.mWidth, chosenMaxRect.mY, diffWidth, chosenMaxRect.mHeight)); } int32 diffHeight = chosenMaxRect.mHeight - rect.mHeight; // new max rect on top of the placed rect if (diffHeight > 0) { mPendingRects.push_back(BoundingBox(chosenMaxRect.mX, chosenMaxRect.mY + rect.mHeight, chosenMaxRect.mWidth, diffHeight)); } coords[bestRectIndex] = RectangleCoords(chosenMaxRect.mX, chosenMaxRect.mY); // save the coords of the placed rectangle return BoundingBox(chosenMaxRect.mX, chosenMaxRect.mY, rect.mWidth, rect.mHeight); } void RectanglePacker::subdivideMaxRects(const BoundingBox &usedSpace) { size_t numMaxRects = mMaxRects.size(); for (size_t i = 0; i < numMaxRects;) { BoundingBox maxRect = mMaxRects[i]; int32 maxRectRight1 = maxRect.mX + maxRect.mWidth; // right + 1 and top + 1 of the bounding boxes int32 maxRectTop1 = maxRect.mY + maxRect.mHeight; // maxRectTop1 - 1 is the topmost line belonging to max rect int32 usedSpaceRight1 = usedSpace.mX + usedSpace.mWidth; int32 usedSpaceTop1 = usedSpace.mY + usedSpace.mHeight; if (usedSpace.mX >= maxRectRight1 || usedSpace.mY >= maxRectTop1 || // skip it if max rect is not intersected maxRect.mX >= usedSpaceRight1 || maxRect.mY >= usedSpaceTop1) { ++i; continue; } mMaxRects[i] = mMaxRects.back(); // remove it since its space is not completely free anymore mMaxRects.pop_back(); --numMaxRects; // there are up to 4 new max rects: left int32 width = usedSpace.mX - maxRect.mX; // left rectangle if (width > 0) mPendingRects.push_back(BoundingBox(maxRect.mX, maxRect.mY, width, maxRect.mHeight)); int32 height = usedSpace.mY - maxRect.mY; if (height > 0) // bottom rectangle mPendingRects.push_back(BoundingBox(maxRect.mX, maxRect.mY, maxRect.mWidth, height)); width = maxRectRight1 - usedSpaceRight1; // right rectangle if (width > 0) mPendingRects.push_back(BoundingBox(usedSpaceRight1, maxRect.mY, width, maxRect.mHeight)); height = maxRectTop1 - usedSpaceTop1; // top rectangle if (height > 0) mPendingRects.push_back(BoundingBox(maxRect.mX, usedSpaceTop1, maxRect.mWidth, height)); } } void RectanglePacker::processPendingRects() { size_t numMaxRects = mMaxRects.size(); for (size_t i = 0; i < numMaxRects; ++i) // is any intersection result rectangle (IRR) completely { // contained by a max rect? BoundingBox maxRect = mMaxRects[i]; for (list<BoundingBox>::iterator it = mPendingRects.begin(); it != mPendingRects.end(); ) { if (maxRect.contains(*it)) // remove the IRR if it is not a maximum rectangle { it = mPendingRects.erase(it); continue; } ++it; } } // TODO: looks dangerous - does this really work? for (list<BoundingBox>::iterator bb1 = mPendingRects.begin(); // does any IRR completely contain another IRR? bb1 != mPendingRects.end(); ++bb1) { for (list<BoundingBox>::iterator bb2 = mPendingRects.begin(); bb2 != mPendingRects.end(); ) { if ((bb1 != bb2) && bb1->contains(*bb2)) { bb2 = mPendingRects.erase(bb2); continue; } ++bb2; } } for (list<BoundingBox>::iterator it = mPendingRects.begin(); it != mPendingRects.end(); ++it) // add all IRRs which are max rects to the mMaxRects mMaxRects.push_back(*it); mPendingRects.resize(0); }
npocmaka/Windows-Server-2003
base/ntsetup/cobra/engine/ism/modules.c
<reponame>npocmaka/Windows-Server-2003 /*++ Copyright (c) 1999 Microsoft Corporation Module Name: modules.c Abstract: Implements routines that are common to the entire ISM. Author: <NAME> (jimschm) 21-Mar-2000 Revision History: <alias> <date> <comments> --*/ // // Includes // #include "pch.h" #include "ism.h" #include "ismp.h" #define DBG_ISM "Ism" // // Strings // // None // // Constants // // None // // Macros // // None // // Types // typedef struct { UINT RefCount; HMODULE Handle; } MODULEDATA, *PMODULEDATA; // // Globals // HASHTABLE g_ModuleTable; HASHTABLE g_EtmTable; HASHTABLE g_VcmTable; HASHTABLE g_SgmTable; HASHTABLE g_SamTable; HASHTABLE g_DgmTable; HASHTABLE g_DamTable; HASHTABLE g_CsmTable; HASHTABLE g_OpmTable; // // Macro expansion list // // None // // Private function prototypes // VOID pFreeEtmTable ( VOID ); // // Macro expansion definition // // None // // Code // VOID pFindModule ( IN PCTSTR ModulePath, OUT PTSTR FullModulePath ) { HANDLE result = NULL; TCHAR relativePath[MAX_PATH] = TEXT(""); PCTSTR fileName; PTSTR p; fileName = GetFileNameFromPath (ModulePath); if (fileName) { if (GetModuleFileName (g_hInst, relativePath, ARRAYSIZE(relativePath))) { p = _tcsrchr (relativePath, TEXT('\\')); if (p) { p++; StringCopyByteCount ( p, fileName, sizeof (relativePath) - (HALF_PTR) ((PBYTE) p - (PBYTE) relativePath) ); } if (DoesFileExist (relativePath)) { StringCopy (FullModulePath, relativePath); return; } } } GetFullPathName (ModulePath, ARRAYSIZE(relativePath), relativePath, (PTSTR *) &fileName); if (DoesFileExist (relativePath)) { StringCopy (FullModulePath, relativePath); return; } if (SearchPath (NULL, fileName, NULL, MAX_PATH, FullModulePath, &p)) { return; } StringCopy (FullModulePath, ModulePath); } PMODULEDATA pGetModuleData ( IN PCTSTR ModulePath ) { HASHITEM rc; PMODULEDATA moduleData; rc = HtFindStringEx ( g_ModuleTable, ModulePath, &moduleData, FALSE ); if (!rc) { return NULL; } return moduleData; } BOOL pRegisterModule ( IN PCTSTR ModulePath, IN HMODULE ModuleHandle ) { PMODULEDATA moduleData; PMODULEINITIALIZE moduleInitialize = NULL; BOOL result = TRUE; moduleData = pGetModuleData (ModulePath); if (moduleData) { if (moduleData->RefCount == 0) { moduleData->Handle = ModuleHandle; // time to call the initialization routine moduleInitialize = (PMODULEINITIALIZE) GetProcAddress (moduleData->Handle, "ModuleInitialize"); if (moduleInitialize) { result = moduleInitialize (); } } MYASSERT (moduleData->Handle == ModuleHandle); moduleData->RefCount ++; } else { moduleData = (PMODULEDATA) PmGetMemory (g_IsmUntrackedPool, sizeof (MODULEDATA)); ZeroMemory (moduleData, sizeof (MODULEDATA)); moduleData->RefCount = 1; moduleData->Handle = ModuleHandle; // time to call the initialization routine moduleInitialize = (PMODULEINITIALIZE) GetProcAddress (moduleData->Handle, "ModuleInitialize"); if (moduleInitialize) { result = moduleInitialize (); } HtAddStringEx (g_ModuleTable, ModulePath, &moduleData, FALSE); } return TRUE; } BOOL pUnregisterModule ( IN PCTSTR ModulePath ) { PMODULEDATA moduleData; PMODULETERMINATE moduleTerminate = NULL; moduleData = pGetModuleData (ModulePath); if (moduleData) { if (moduleData->RefCount) { moduleData->RefCount --; if (moduleData->RefCount == 0) { // time to call the termination routine moduleTerminate = (PMODULETERMINATE) GetProcAddress (moduleData->Handle, "ModuleTerminate"); if (moduleTerminate) { moduleTerminate (); } FreeLibrary (moduleData->Handle); moduleData->Handle = NULL; } } else { DEBUGMSG ((DBG_WHOOPS, "Too many UnregisterModule called for %s", ModulePath)); } } return TRUE; } VOID pFreeRegisteredModules ( VOID ) { PMODULEDATA moduleData; PMODULETERMINATE moduleTerminate = NULL; HASHTABLE_ENUM e; if (g_ModuleTable) { if (EnumFirstHashTableString (&e, g_ModuleTable)) { do { moduleData = *((PMODULEDATA *) e.ExtraData); if (moduleData) { if (moduleData->RefCount) { DEBUGMSG ((DBG_WHOOPS, "Registered module was not unregistered.")); moduleData->RefCount = 0; moduleTerminate = (PMODULETERMINATE) GetProcAddress (moduleData->Handle, "ModuleTerminate"); if (moduleTerminate) { moduleTerminate (); } FreeLibrary (moduleData->Handle); } } } while (EnumNextHashTableString (&e)); } HtFree (g_ModuleTable); g_ModuleTable = NULL; } } BOOL pRegisterEtm ( IN MIG_PLATFORMTYPEID Platform, IN PCTSTR ModuleId, IN PCTSTR ModulePath, IN PVOID Reserved ) { PETMDATA etmData; HASHITEM rc; PTYPEMODULE queryTypeModule; TYPE_ENTRYPOINTS entryPoints; TCHAR fullModulePath[MAX_TCHAR_PATH]; rc = HtFindString (g_EtmTable, ModuleId); if (rc) { return FALSE; } etmData = (PETMDATA) PmGetAlignedMemory (g_IsmUntrackedPool, sizeof (ETMDATA)); ZeroMemory (etmData, sizeof (ETMDATA)); pFindModule (ModulePath, fullModulePath); etmData->EtmPath = PmDuplicateString (g_IsmUntrackedPool, fullModulePath); etmData->LibHandle = LoadLibrary (fullModulePath); if (etmData->LibHandle) { queryTypeModule = (PTYPEMODULE) GetProcAddress (etmData->LibHandle, "TypeModule"); if (queryTypeModule) { ZeroMemory (&entryPoints, sizeof (entryPoints)); entryPoints.Version = ISM_VERSION; if (queryTypeModule (ModuleId, &entryPoints)) { etmData->EtmInitialize = entryPoints.EtmInitialize; etmData->EtmParse = entryPoints.EtmParse; etmData->EtmTerminate = entryPoints.EtmTerminate; etmData->EtmNewUserCreated = entryPoints.EtmNewUserCreated; if (etmData->EtmInitialize) { etmData->ShouldBeCalled = TRUE; } } else { LOG ((LOG_MODULE_ERROR, (PCSTR) MSG_DLL_DOES_NOT_SUPPORT_TAG, fullModulePath, ModuleId)); } } else { LOG ((LOG_MODULE_ERROR, (PCSTR) MSG_ETM_ENTRYPOINT_MISSING, fullModulePath)); } } else { LOG ((LOG_WARNING, (PCSTR) MSG_LOADLIBRARY_FAILURE, ModuleId)); } if (etmData->ShouldBeCalled) { etmData->Group = PmDuplicateString (g_IsmUntrackedPool, ModuleId); HtAddStringEx (g_EtmTable, ModuleId, &etmData, FALSE); if (pRegisterModule (fullModulePath, etmData->LibHandle)) { MYASSERT (!g_CurrentGroup); g_CurrentGroup = ModuleId; if (!etmData->EtmInitialize (Platform, g_LogCallback, Reserved)) { LOG ((LOG_MODULE_ERROR, (PCSTR) MSG_MODULE_RETURNED_FAILURE, ModuleId)); etmData->ShouldBeCalled = FALSE; } g_CurrentGroup = NULL; etmData->Initialized = TRUE; } else { etmData->ShouldBeCalled = FALSE; LOG ((LOG_MODULE_ERROR, (PCSTR) MSG_MODULEINIT_FAILURE, ModuleId)); } } return etmData->ShouldBeCalled; } BOOL pRegisterVcm ( IN PCTSTR ModuleId, IN PCTSTR ModulePath, IN PVOID Reserved ) { PVCMDATA vcmData; HASHITEM rc; PVIRTUALCOMPUTERMODULE queryEntryPoints; VIRTUAL_COMPUTER_ENTRYPOINTS entryPoints; TCHAR fullModulePath[MAX_TCHAR_PATH]; pFindModule (ModulePath, fullModulePath); rc = HtFindString (g_VcmTable, ModuleId); if (rc) { return FALSE; } vcmData = (PVCMDATA) PmGetAlignedMemory (g_IsmUntrackedPool, sizeof (VCMDATA)); ZeroMemory (vcmData, sizeof (VCMDATA)); vcmData->VcmPath = PmDuplicateString (g_IsmUntrackedPool, fullModulePath); vcmData->LibHandle = LoadLibrary (fullModulePath); if (vcmData->LibHandle) { queryEntryPoints = (PVIRTUALCOMPUTERMODULE) GetProcAddress ( vcmData->LibHandle, "VirtualComputerModule" ); if (queryEntryPoints) { ZeroMemory (&entryPoints, sizeof (entryPoints)); entryPoints.Version = ISM_VERSION; if (queryEntryPoints (ModuleId, &entryPoints)) { vcmData->VcmInitialize = entryPoints.VcmInitialize; vcmData->VcmParse = entryPoints.VcmParse; vcmData->VcmQueueEnumeration = entryPoints.VcmQueueEnumeration; vcmData->VcmQueueHighPriorityEnumeration = entryPoints.VcmQueueHighPriorityEnumeration; vcmData->VcmTerminate = entryPoints.VcmTerminate; if (vcmData->VcmInitialize && vcmData->VcmQueueEnumeration) { vcmData->ShouldBeCalled = TRUE; } } else { LOG ((LOG_MODULE_ERROR, (PCSTR) MSG_DLL_DOES_NOT_SUPPORT_TAG, fullModulePath, ModuleId)); } } else { LOG ((LOG_MODULE_ERROR, (PCSTR) MSG_VCM_ENTRYPOINT_MISSING, fullModulePath)); } } else { LOG ((LOG_WARNING, (PCSTR) MSG_LOADLIBRARY_FAILURE, ModuleId)); } if (vcmData->ShouldBeCalled) { vcmData->Group = PmDuplicateString (g_IsmUntrackedPool, ModuleId); HtAddStringEx (g_VcmTable, ModuleId, &vcmData, FALSE); if (pRegisterModule (fullModulePath, vcmData->LibHandle)) { MYASSERT (!g_CurrentGroup); g_CurrentGroup = ModuleId; if (!vcmData->VcmInitialize (g_LogCallback, Reserved)) { LOG ((LOG_MODULE_ERROR, (PCSTR) MSG_MODULE_RETURNED_FAILURE, ModuleId)); vcmData->ShouldBeCalled = FALSE; } g_CurrentGroup = NULL; vcmData->Initialized = TRUE; } else { vcmData->ShouldBeCalled = FALSE; LOG ((LOG_MODULE_ERROR, (PCSTR) MSG_MODULEINIT_FAILURE, ModuleId)); } } return vcmData->ShouldBeCalled; } BOOL pRegisterSm ( IN PCTSTR ModuleId, IN PCTSTR ModulePath, IN PVOID Reserved ) { PSGMDATA sgmData; PSAMDATA samData; HASHITEM rc; PSOURCEMODULE queryEntryPoints; SOURCE_ENTRYPOINTS entryPoints; TCHAR fullModulePath[MAX_TCHAR_PATH]; pFindModule (ModulePath, fullModulePath); rc = HtFindString (g_SgmTable, ModuleId); if (!rc) { rc = HtFindString (g_SamTable, ModuleId); } if (rc) { return FALSE; } sgmData = (PSGMDATA) PmGetAlignedMemory (g_IsmUntrackedPool, sizeof (SGMDATA)); ZeroMemory (sgmData, sizeof (SGMDATA)); samData = (PSAMDATA) PmGetAlignedMemory (g_IsmUntrackedPool, sizeof (SAMDATA)); ZeroMemory (samData, sizeof (SAMDATA)); sgmData->SgmPath = PmDuplicateString (g_IsmUntrackedPool, fullModulePath); sgmData->LibHandle = LoadLibrary (fullModulePath); samData->SamPath = sgmData->SgmPath; samData->LibHandle = sgmData->LibHandle; if (sgmData->LibHandle) { queryEntryPoints = (PSOURCEMODULE) GetProcAddress (sgmData->LibHandle, "SourceModule"); if (queryEntryPoints) { ZeroMemory (&entryPoints, sizeof (entryPoints)); entryPoints.Version = ISM_VERSION; if (queryEntryPoints (ModuleId, &entryPoints)) { sgmData->SgmInitialize = entryPoints.SgmInitialize; sgmData->SgmParse = entryPoints.SgmParse; sgmData->SgmQueueEnumeration = entryPoints.SgmQueueEnumeration; sgmData->SgmQueueHighPriorityEnumeration = entryPoints.SgmQueueHighPriorityEnumeration; sgmData->SgmTerminate = entryPoints.SgmTerminate; if (sgmData->SgmInitialize && sgmData->SgmQueueEnumeration) { sgmData->ShouldBeCalled = TRUE; } samData->SamInitialize = entryPoints.SamInitialize; samData->SamExecute = entryPoints.SamExecute; samData->SamEstimateProgressBar = entryPoints.SamEstimateProgressBar; samData->SamTerminate = entryPoints.SamTerminate; if (samData->SamInitialize && samData->SamExecute) { samData->ShouldBeCalled = TRUE; } } else { LOG ((LOG_MODULE_ERROR, (PCSTR) MSG_DLL_DOES_NOT_SUPPORT_TAG, fullModulePath, ModuleId)); } } else { LOG ((LOG_MODULE_ERROR, (PCSTR) MSG_SOURCE_ENTRYPOINT_MISSING, fullModulePath)); } } else { LOG ((LOG_WARNING, (PCSTR) MSG_LOADLIBRARY_FAILURE, ModuleId)); } if (sgmData->ShouldBeCalled) { sgmData->Group = PmDuplicateString (g_IsmUntrackedPool, ModuleId); HtAddStringEx (g_SgmTable, ModuleId, &sgmData, FALSE); if (pRegisterModule (fullModulePath, sgmData->LibHandle)) { MYASSERT (!g_CurrentGroup); g_CurrentGroup = ModuleId; if (!sgmData->SgmInitialize (g_LogCallback, Reserved)) { LOG ((LOG_MODULE_ERROR, (PCSTR) MSG_MODULE_RETURNED_FAILURE, ModuleId)); sgmData->ShouldBeCalled = FALSE; } g_CurrentGroup = NULL; sgmData->Initialized = TRUE; } else { sgmData->ShouldBeCalled = FALSE; LOG ((LOG_MODULE_ERROR, (PCSTR) MSG_MODULEINIT_FAILURE, ModuleId)); } } if (samData->ShouldBeCalled) { samData->Group = PmDuplicateString (g_IsmUntrackedPool, ModuleId); HtAddStringEx (g_SamTable, ModuleId, &samData, FALSE); if (pRegisterModule (fullModulePath, samData->LibHandle)) { MYASSERT (!g_CurrentGroup); g_CurrentGroup = ModuleId; if (!samData->SamInitialize (g_LogCallback, Reserved)) { LOG ((LOG_MODULE_ERROR, (PCSTR) MSG_MODULE_RETURNED_FAILURE, ModuleId)); samData->ShouldBeCalled = FALSE; } g_CurrentGroup = NULL; samData->Initialized = TRUE; } else { samData->ShouldBeCalled = FALSE; LOG ((LOG_MODULE_ERROR, (PCSTR) MSG_MODULEINIT_FAILURE, ModuleId)); } } return sgmData->ShouldBeCalled || samData->ShouldBeCalled; } BOOL pRegisterDm ( IN PCTSTR ModuleId, IN PCTSTR ModulePath, IN PVOID Reserved ) { PDAMDATA damData; PDGMDATA dgmData; PCSMDATA csmData; POPMDATA opmData; HASHITEM rc; PDESTINATIONMODULE queryEntryPoints; DESTINATION_ENTRYPOINTS entryPoints; TCHAR fullModulePath[MAX_TCHAR_PATH]; pFindModule (ModulePath, fullModulePath); rc = HtFindString (g_DgmTable, ModuleId); if (!rc) { rc = HtFindString (g_DamTable, ModuleId); } if (!rc) { rc = HtFindString (g_CsmTable, ModuleId); } if (!rc) { rc = HtFindString (g_OpmTable, ModuleId); } if (rc) { return FALSE; } dgmData = (PDGMDATA) PmGetAlignedMemory (g_IsmUntrackedPool, sizeof (DGMDATA)); ZeroMemory (dgmData, sizeof (DGMDATA)); dgmData->DgmPath = PmDuplicateString (g_IsmUntrackedPool, fullModulePath); dgmData->LibHandle = LoadLibrary (fullModulePath); damData = (PDAMDATA) PmGetAlignedMemory (g_IsmUntrackedPool, sizeof (DAMDATA)); ZeroMemory (damData, sizeof (DAMDATA)); damData->DamPath = dgmData->DgmPath; damData->LibHandle = dgmData->LibHandle; csmData = (PCSMDATA) PmGetAlignedMemory (g_IsmUntrackedPool, sizeof (CSMDATA)); ZeroMemory (csmData, sizeof (CSMDATA)); csmData->CsmPath = dgmData->DgmPath; csmData->LibHandle = dgmData->LibHandle; opmData = (POPMDATA) PmGetAlignedMemory (g_IsmUntrackedPool, sizeof (OPMDATA)); ZeroMemory (opmData, sizeof (OPMDATA)); opmData->OpmPath = dgmData->DgmPath; opmData->LibHandle = dgmData->LibHandle; if (dgmData->LibHandle) { queryEntryPoints = (PDESTINATIONMODULE) GetProcAddress (dgmData->LibHandle, "DestinationModule"); if (queryEntryPoints) { ZeroMemory (&entryPoints, sizeof (entryPoints)); entryPoints.Version = ISM_VERSION; if (queryEntryPoints (ModuleId, &entryPoints)) { dgmData->DgmInitialize = entryPoints.DgmInitialize; dgmData->DgmQueueEnumeration = entryPoints.DgmQueueEnumeration; dgmData->DgmQueueHighPriorityEnumeration = entryPoints.DgmQueueHighPriorityEnumeration; dgmData->DgmTerminate = entryPoints.DgmTerminate; if (dgmData->DgmInitialize && dgmData->DgmQueueEnumeration) { dgmData->ShouldBeCalled = TRUE; } damData->DamInitialize = entryPoints.DamInitialize; damData->DamExecute = entryPoints.DamExecute; damData->DamEstimateProgressBar = entryPoints.DamEstimateProgressBar; damData->DamTerminate = entryPoints.DamTerminate; if (damData->DamInitialize && damData->DamExecute) { damData->ShouldBeCalled = TRUE; } csmData->CsmInitialize = entryPoints.CsmInitialize; csmData->CsmExecute = entryPoints.CsmExecute; csmData->CsmEstimateProgressBar = entryPoints.CsmEstimateProgressBar; csmData->CsmTerminate = entryPoints.CsmTerminate; if (csmData->CsmInitialize && csmData->CsmExecute) { csmData->ShouldBeCalled = TRUE; } opmData->OpmInitialize = entryPoints.OpmInitialize; opmData->OpmTerminate = entryPoints.OpmTerminate; if (opmData->OpmInitialize) { opmData->ShouldBeCalled = TRUE; } } } else { LOG ((LOG_MODULE_ERROR, (PCSTR) MSG_DEST_ENTRYPOINT_MISSING, fullModulePath)); } } else { LOG ((LOG_WARNING, (PCSTR) MSG_LOADLIBRARY_FAILURE, ModuleId)); } if (dgmData->ShouldBeCalled) { dgmData->Group = PmDuplicateString (g_IsmUntrackedPool, ModuleId); HtAddStringEx (g_DgmTable, ModuleId, &dgmData, FALSE); if (pRegisterModule (fullModulePath, dgmData->LibHandle)) { MYASSERT (!g_CurrentGroup); g_CurrentGroup = ModuleId; if (!dgmData->DgmInitialize (g_LogCallback, Reserved)) { LOG ((LOG_MODULE_ERROR, (PCSTR) MSG_MODULE_RETURNED_FAILURE, ModuleId)); dgmData->ShouldBeCalled = FALSE; } g_CurrentGroup = NULL; dgmData->Initialized = TRUE; } else { dgmData->ShouldBeCalled = FALSE; LOG ((LOG_MODULE_ERROR, (PCSTR) MSG_MODULEINIT_FAILURE, ModuleId)); } } if (damData->ShouldBeCalled) { damData->Group = PmDuplicateString (g_IsmUntrackedPool, ModuleId); HtAddStringEx (g_DamTable, ModuleId, &damData, FALSE); if (pRegisterModule (fullModulePath, damData->LibHandle)) { MYASSERT (!g_CurrentGroup); g_CurrentGroup = ModuleId; if (!damData->DamInitialize (g_LogCallback, Reserved)) { LOG ((LOG_MODULE_ERROR, (PCSTR) MSG_MODULE_RETURNED_FAILURE, ModuleId)); damData->ShouldBeCalled = FALSE; } g_CurrentGroup = NULL; damData->Initialized = TRUE; } else { damData->ShouldBeCalled = FALSE; LOG ((LOG_MODULE_ERROR, (PCSTR) MSG_MODULEINIT_FAILURE, ModuleId)); } } if (csmData->ShouldBeCalled) { csmData->Group = PmDuplicateString (g_IsmUntrackedPool, ModuleId); HtAddStringEx (g_CsmTable, ModuleId, &csmData, FALSE); if (pRegisterModule (fullModulePath, csmData->LibHandle)) { MYASSERT (!g_CurrentGroup); g_CurrentGroup = ModuleId; if (!csmData->CsmInitialize (g_LogCallback, Reserved)) { LOG ((LOG_MODULE_ERROR, (PCSTR) MSG_MODULE_RETURNED_FAILURE, ModuleId)); csmData->ShouldBeCalled = FALSE; } g_CurrentGroup = NULL; csmData->Initialized = TRUE; } else { csmData->ShouldBeCalled = FALSE; LOG ((LOG_MODULE_ERROR, (PCSTR) MSG_MODULEINIT_FAILURE, ModuleId)); } } if (opmData->ShouldBeCalled) { opmData->Group = PmDuplicateString (g_IsmUntrackedPool, ModuleId); HtAddStringEx (g_OpmTable, ModuleId, &opmData, FALSE); if (pRegisterModule (fullModulePath, opmData->LibHandle)) { MYASSERT (!g_CurrentGroup); g_CurrentGroup = ModuleId; if (!opmData->OpmInitialize (g_LogCallback, Reserved)) { LOG ((LOG_MODULE_ERROR, (PCSTR) MSG_MODULE_RETURNED_FAILURE, ModuleId)); opmData->ShouldBeCalled = FALSE; } g_CurrentGroup = NULL; opmData->Initialized = TRUE; } else { opmData->ShouldBeCalled = FALSE; LOG ((LOG_MODULE_ERROR, (PCSTR) MSG_MODULEINIT_FAILURE, ModuleId)); } } return dgmData->ShouldBeCalled || damData->ShouldBeCalled || csmData->ShouldBeCalled || opmData->ShouldBeCalled; } BOOL pRegisterTransport ( IN PCTSTR ModuleId, IN PCTSTR ModulePath, IN PVOID Reserved ) { PTRANSPORTDATA transportData; HASHITEM rc; PTRANSPORTMODULE queryEntryPoints; TRANSPORT_ENTRYPOINTS entryPoints; TCHAR fullModulePath[MAX_TCHAR_PATH]; pFindModule (ModulePath, fullModulePath); rc = HtFindString (g_TransportTable, ModuleId); if (rc) { return FALSE; } transportData = (PTRANSPORTDATA) PmGetAlignedMemory (g_IsmUntrackedPool, sizeof (TRANSPORTDATA)); ZeroMemory (transportData, sizeof (TRANSPORTDATA)); transportData->TransportPath = PmDuplicateString (g_IsmUntrackedPool, fullModulePath); transportData->LibHandle = LoadLibrary (fullModulePath); if (transportData->LibHandle) { queryEntryPoints = (PTRANSPORTMODULE) GetProcAddress (transportData->LibHandle, "TransportModule"); if (queryEntryPoints) { ZeroMemory (&entryPoints, sizeof (entryPoints)); entryPoints.Version = ISM_VERSION; if (queryEntryPoints (ModuleId, &entryPoints)) { transportData->TransportInitialize = entryPoints.TransportInitialize; transportData->TransportTerminate = entryPoints.TransportTerminate; transportData->TransportQueryCapabilities = entryPoints.TransportQueryCapabilities; transportData->TransportSetStorage = entryPoints.TransportSetStorage; transportData->TransportResetStorage = entryPoints.TransportResetStorage; transportData->TransportSaveState = entryPoints.TransportSaveState; transportData->TransportResumeSaveState = entryPoints.TransportResumeSaveState; transportData->TransportBeginApply = entryPoints.TransportBeginApply; transportData->TransportResumeApply = entryPoints.TransportResumeApply; transportData->TransportAcquireObject = entryPoints.TransportAcquireObject; transportData->TransportReleaseObject = entryPoints.TransportReleaseObject; transportData->TransportEndApply = entryPoints.TransportEndApply; transportData->TransportEstimateProgressBar = entryPoints.TransportEstimateProgressBar; if (transportData->TransportInitialize && transportData->TransportTerminate && transportData->TransportQueryCapabilities && transportData->TransportSetStorage && transportData->TransportSaveState && transportData->TransportBeginApply && transportData->TransportAcquireObject && transportData->TransportReleaseObject && transportData->TransportEndApply ) { transportData->ShouldBeCalled = TRUE; } } } else { LOG ((LOG_MODULE_ERROR, (PCSTR) MSG_TRANS_ENTRYPOINT_MISSING, fullModulePath)); } } else { LOG ((LOG_WARNING, (PCSTR) MSG_LOADLIBRARY_FAILURE, ModuleId)); } if (transportData->ShouldBeCalled) { transportData->Group = PmDuplicateString (g_IsmUntrackedPool, ModuleId); HtAddStringEx (g_TransportTable, ModuleId, &transportData, FALSE); if (pRegisterModule (fullModulePath, transportData->LibHandle)) { MYASSERT (!g_CurrentGroup); g_CurrentGroup = ModuleId; if (!transportData->TransportInitialize (g_LogCallback)) { LOG ((LOG_MODULE_ERROR, (PCSTR) MSG_MODULE_RETURNED_FAILURE, ModuleId)); transportData->ShouldBeCalled = FALSE; } g_CurrentGroup = NULL; transportData->Initialized = TRUE; } else { transportData->ShouldBeCalled = FALSE; LOG ((LOG_MODULE_ERROR, (PCSTR) MSG_MODULEINIT_FAILURE, ModuleId)); } } return transportData->ShouldBeCalled; } VOID pAllocModuleTables ( VOID ) { if (!g_VcmTable) { g_VcmTable = HtAllocWithData (sizeof (PVCMDATA)); } if (!g_SgmTable) { g_SgmTable = HtAllocWithData (sizeof (PSGMDATA)); } if (!g_SamTable) { g_SamTable = HtAllocWithData (sizeof (PSAMDATA)); } if (!g_DgmTable) { g_DgmTable = HtAllocWithData (sizeof (PDGMDATA)); } if (!g_DamTable) { g_DamTable = HtAllocWithData (sizeof (PDAMDATA)); } if (!g_CsmTable) { g_CsmTable = HtAllocWithData (sizeof (PCSMDATA)); } if (!g_OpmTable) { g_OpmTable = HtAllocWithData (sizeof (POPMDATA)); } } VOID pFreeModuleTables ( VOID ) { HASHTABLE_ENUM e; POPMDATA opmData; PCSMDATA csmData; PDAMDATA damData; PDGMDATA dgmData; PSAMDATA samData; PSGMDATA sgmData; PVCMDATA vcmData; if (g_OpmTable) { if (EnumFirstHashTableString (&e, g_OpmTable)) { do { opmData = *((POPMDATA *) e.ExtraData); if (opmData) { if (opmData->Initialized && opmData->OpmTerminate) { opmData->OpmTerminate (); } if (opmData->OpmPath) { pUnregisterModule (opmData->OpmPath); // opmData->OpmPath is owned by DGM } } } while (EnumNextHashTableString (&e)); } HtFree (g_OpmTable); g_OpmTable = NULL; } if (g_CsmTable) { if (EnumFirstHashTableString (&e, g_CsmTable)) { do { csmData = *((PCSMDATA *) e.ExtraData); if (csmData) { if (csmData->Initialized && csmData->CsmTerminate) { csmData->CsmTerminate (); } if (csmData->CsmPath) { pUnregisterModule (csmData->CsmPath); // csmData->CsmPath is owned by DGM } } } while (EnumNextHashTableString (&e)); } HtFree (g_CsmTable); g_CsmTable = NULL; } if (g_DamTable) { if (EnumFirstHashTableString (&e, g_DamTable)) { do { damData = *((PDAMDATA *) e.ExtraData); if (damData) { if (damData->Initialized && damData->DamTerminate) { damData->DamTerminate (); } if (damData->DamPath) { pUnregisterModule (damData->DamPath); // damData->DamPath is owned by DGM } } } while (EnumNextHashTableString (&e)); } HtFree (g_DamTable); g_DamTable = NULL; } if (g_DgmTable) { if (EnumFirstHashTableString (&e, g_DgmTable)) { do { dgmData = *((PDGMDATA *) e.ExtraData); if (dgmData) { if (dgmData->Initialized && dgmData->DgmTerminate) { dgmData->DgmTerminate (); } if (dgmData->DgmPath) { pUnregisterModule (dgmData->DgmPath); } } } while (EnumNextHashTableString (&e)); } HtFree (g_DgmTable); g_DgmTable = NULL; } if (g_SamTable) { if (EnumFirstHashTableString (&e, g_SamTable)) { do { samData = *((PSAMDATA *) e.ExtraData); if (samData) { if (samData->Initialized && samData->SamTerminate) { samData->SamTerminate (); } if (samData->SamPath) { pUnregisterModule (samData->SamPath); // samData->SamPath is owned by SGM } } } while (EnumNextHashTableString (&e)); } HtFree (g_SamTable); g_SamTable = NULL; } if (g_SgmTable) { if (EnumFirstHashTableString (&e, g_SgmTable)) { do { sgmData = *((PSGMDATA *) e.ExtraData); if (sgmData) { if (sgmData->Initialized && sgmData->SgmTerminate) { sgmData->SgmTerminate (); } if (sgmData->SgmPath) { pUnregisterModule (sgmData->SgmPath); } } } while (EnumNextHashTableString (&e)); } HtFree (g_SgmTable); g_SgmTable = NULL; } if (g_VcmTable) { if (EnumFirstHashTableString (&e, g_VcmTable)) { do { vcmData = *((PVCMDATA *) e.ExtraData); if (vcmData) { if (vcmData->Initialized && vcmData->VcmTerminate) { vcmData->VcmTerminate (); } if (vcmData->VcmPath) { pUnregisterModule (vcmData->VcmPath); } } } while (EnumNextHashTableString (&e)); } HtFree (g_VcmTable); g_VcmTable = NULL; } } VOID pFreeTransportTable ( VOID ) { PTRANSPORTDATA transportData; HASHTABLE_ENUM e; if (g_TransportTable) { if (EnumFirstHashTableString (&e, g_TransportTable)) { do { transportData = *((PTRANSPORTDATA *) e.ExtraData); if (transportData) { if (transportData->Initialized && transportData->TransportTerminate) { transportData->TransportTerminate (); } if (transportData->TransportPath) { pUnregisterModule (transportData->TransportPath); } } } while (EnumNextHashTableString (&e)); } HtFree (g_TransportTable); g_TransportTable = NULL; } } BOOL ValidateModuleName ( IN PCTSTR ModuleName ) { if (StringIMatch (ModuleName, S_COMMON)) { return FALSE; } if (!IsValidCName (ModuleName)) { return FALSE; } return TRUE; } BOOL InitializeVcmModules ( IN PVOID Reserved ) { INFSTRUCT is = INITINFSTRUCT_PMHANDLE; PCTSTR modulePath; PCTSTR moduleId; BOOL b = TRUE; BOOL cancelled = FALSE; PCTSTR sectionName; // // Initialize external modules // pAllocModuleTables(); sectionName = TEXT("Virtual Computer Modules"); if (InfFindFirstLine (g_IsmInf, sectionName, NULL, &is)) { do { // // A source gather module has an ID and module path // moduleId = InfGetStringField (&is, 0); modulePath = InfGetStringField (&is, 1); if (!ValidateModuleName (moduleId)) { LOG ((LOG_WARNING, (PCSTR) MSG_INVALID_ID, moduleId)); continue; } if (moduleId && modulePath) { // // Register the VCM in an internal database // b = pRegisterVcm (moduleId, modulePath, Reserved); cancelled = CheckCancel(); if (!b) { if (cancelled) { LOG ((LOG_MODULE_ERROR, (PCSTR) MSG_MODULE_RETURNED_FAILURE, moduleId)); break; } else { LOG ((LOG_INFORMATION, (PCSTR) MSG_IGNORE_MODULE, moduleId)); } } } } while (InfFindNextLine (&is)); } if (cancelled) { return FALSE; } InfCleanUpInfStruct (&is); if (!b) { pFreeModuleTables(); } return b; } BOOL InitializeModules ( IN MIG_PLATFORMTYPEID Platform, IN PVOID Reserved ) { INFSTRUCT is = INITINFSTRUCT_PMHANDLE; PCTSTR modulePath; PCTSTR moduleId; BOOL b = TRUE; BOOL cancelled = FALSE; __try { // // Initialize external modules // pAllocModuleTables(); if (Platform == PLATFORM_SOURCE) { if (InfFindFirstLine (g_IsmInf, TEXT("Source Modules"), NULL, &is)) { do { // // A source gather module has an ID and module path // moduleId = InfGetStringField (&is, 0); modulePath = InfGetStringField (&is, 1); if (!ValidateModuleName (moduleId)) { LOG ((LOG_WARNING, (PCSTR) MSG_INVALID_ID, moduleId)); continue; } if (moduleId && modulePath) { // // Register the source module in an internal database // b = pRegisterSm (moduleId, modulePath, Reserved); cancelled = CheckCancel(); if (!b) { if (cancelled) { LOG ((LOG_MODULE_ERROR, (PCSTR) MSG_MODULE_RETURNED_FAILURE, moduleId)); break; } else { LOG ((LOG_INFORMATION, (PCSTR) MSG_IGNORE_MODULE, moduleId)); } } } } while (InfFindNextLine (&is)); } if (cancelled) { __leave; } } else if (g_IsmCurrentPlatform == PLATFORM_DESTINATION) { if (InfFindFirstLine (g_IsmInf, TEXT("Destination Modules"), NULL, &is)) { do { // // A destination module has an ID and module path // moduleId = InfGetStringField (&is, 0); modulePath = InfGetStringField (&is, 1); if (!ValidateModuleName (moduleId)) { LOG ((LOG_WARNING, (PCSTR) MSG_INVALID_ID, moduleId)); continue; } if (moduleId && modulePath) { // // Register the destination module in an internal database // b = pRegisterDm (moduleId, modulePath, Reserved); cancelled = CheckCancel(); if (!b) { if (cancelled) { LOG ((LOG_MODULE_ERROR, (PCSTR) MSG_MODULE_RETURNED_FAILURE, moduleId)); break; } else { LOG ((LOG_INFORMATION, (PCSTR) MSG_IGNORE_MODULE, moduleId)); } } } } while (InfFindNextLine (&is)); } if (cancelled) { __leave; } } else { DEBUGMSG ((DBG_ERROR, "InitializeModules: Unknown ISM current platform %d", g_IsmCurrentPlatform)); cancelled = TRUE; } } __finally { if (cancelled) { pFreeModuleTables(); } InfCleanUpInfStruct (&is); } return !cancelled; } VOID TerminateModules ( VOID ) { pFreeModuleTables(); } BOOL pStartEtmModules ( IN MIG_PLATFORMTYPEID Platform ) { INFSTRUCT is = INITINFSTRUCT_PMHANDLE; PCTSTR modulePath; PCTSTR moduleId; BOOL b = TRUE; BOOL cancelled = FALSE; MYASSERT (g_IsmInf != INVALID_HANDLE_VALUE); if (InfFindFirstLine (g_IsmInf, TEXT("Type Modules"), NULL, &is)) { do { // // An ETM has an ID and module path // moduleId = InfGetStringField (&is, 0); modulePath = InfGetStringField (&is, 1); if (!ValidateModuleName (moduleId)) { LOG ((LOG_WARNING, (PCSTR) MSG_INVALID_ID, moduleId)); continue; } if (moduleId && modulePath) { // // Register the ETM in an internal database // b = pRegisterEtm (Platform, moduleId, modulePath, NULL); cancelled = CheckCancel(); if (!b) { if (cancelled) { LOG ((LOG_MODULE_ERROR, (PCSTR) MSG_MODULE_RETURNED_FAILURE, moduleId)); break; } else { LOG ((LOG_INFORMATION, (PCSTR) MSG_IGNORE_MODULE, moduleId)); } } } } while (InfFindNextLine (&is)); } if (cancelled) { return FALSE; } #ifdef PRERELEASE // // If pre-release, read in the exclusions from exclude.inf // { TCHAR path[MAX_PATH]; PTSTR p; HINF inf; MIG_OBJECTSTRINGHANDLE handle; MIG_OBJECTTYPEID typeId; PCTSTR data; PCTSTR leaf; GetWindowsDirectory (path, MAX_PATH); p = _tcschr (path, TEXT('\\')); StringCopy (_tcsinc (p), TEXT("exclude.inf")); inf = InfOpenInfFile (path); if (inf && inf != INVALID_HANDLE_VALUE) { if (InfFindFirstLine (inf, TEXT("Objects"), NULL, &is)) { do { data = InfGetStringField (&is, 1); if (!data) { continue; } typeId = IsmGetObjectTypeId (data); if (!typeId) { LOG ((LOG_ERROR, "EXCLUDE.INF: Invalid object exclusion type: %s", data)); continue; } data = InfGetStringField (&is, 2); if (!data) { LOG ((LOG_ERROR, "EXCLUDE.INF: Missing node object in field 2")); continue; } leaf = InfGetStringField (&is, 3); if (!leaf) { LOG ((LOG_ERROR, "EXCLUDE.INF: Missing leaf object in field 3")); continue; } handle = IsmCreateObjectHandle (data, leaf); if (handle) { IsmRegisterStaticExclusion (typeId, handle); IsmDestroyObjectHandle (handle); } } while (InfFindNextLine (&is)); } if (InfFindFirstLine (inf, TEXT("Nodes"), NULL, &is)) { do { data = InfGetStringField (&is, 1); if (!data) { continue; } typeId = IsmGetObjectTypeId (data); if (!typeId) { LOG ((LOG_ERROR, "EXCLUDE.INF: Invalid node exclusion type: %s", data)); continue; } data = InfGetStringField (&is, 2); if (!data) { LOG ((LOG_ERROR, "EXCLUDE.INF: Missing node object in field 2")); continue; } handle = IsmCreateObjectHandle (data, NULL); if (handle) { IsmRegisterStaticExclusion (typeId, handle); IsmDestroyObjectHandle (handle); } } while (InfFindNextLine (&is)); } if (InfFindFirstLine (inf, TEXT("Leaves"), NULL, &is)) { do { data = InfGetStringField (&is, 1); if (!data) { continue; } typeId = IsmGetObjectTypeId (data); if (!typeId) { LOG ((LOG_ERROR, "EXCLUDE.INF: Invalid leaf exclusion type: %s", data)); continue; } data = InfGetStringField (&is, 2); if (!data) { LOG ((LOG_ERROR, "EXCLUDE.INF: Missing leaf object in field 2")); continue; } handle = IsmCreateObjectHandle (NULL, data); if (handle) { IsmRegisterStaticExclusion (typeId, handle); IsmDestroyObjectHandle (handle); } } while (InfFindNextLine (&is)); } InfCleanUpInfStruct (&is); InfCloseInfFile (inf); } } #endif InfCleanUpInfStruct (&is); if (!b) { pFreeEtmTable (); } return b; } VOID pFreeEtmTable ( VOID ) { PETMDATA etmData; HASHTABLE_ENUM e; if (g_EtmTable) { if (EnumFirstHashTableString (&e, g_EtmTable)) { do { etmData = *((PETMDATA *) e.ExtraData); if (etmData) { if (etmData->Initialized && etmData->EtmTerminate) { etmData->EtmTerminate (); } if (etmData->EtmPath) { pUnregisterModule (etmData->EtmPath); } } } while (EnumNextHashTableString (&e)); } HtFree (g_EtmTable); g_EtmTable = NULL; } } BOOL IsmStartEtmModules ( VOID ) { BOOL result; if (CheckCancel ()) { return FALSE; } g_ExecutionInProgress = TRUE; if (!g_ModuleTable) { g_ModuleTable = HtAllocWithData (sizeof (PMODULEDATA)); } if (!g_EtmTable) { g_EtmTable = HtAllocWithData (sizeof (PETMDATA)); } result = pStartEtmModules (g_IsmCurrentPlatform); #ifdef PRERELEASE LoadCrashHooks (); #endif g_ExecutionInProgress = FALSE; return result; } BOOL BroadcastUserCreation ( IN PTEMPORARYPROFILE UserProfile ) { PETMDATA etmData; HASHTABLE_ENUM e; if (g_EtmTable) { if (EnumFirstHashTableString (&e, g_EtmTable)) { do { etmData = *((PETMDATA *) e.ExtraData); if (etmData) { if (etmData->Initialized && etmData->EtmNewUserCreated) { etmData->EtmNewUserCreated ( UserProfile->UserName, UserProfile->DomainName, UserProfile->UserProfileRoot, UserProfile->UserSid ); } } } while (EnumNextHashTableString (&e)); } } return TRUE; } VOID TerminateProcessWideModules ( VOID ) { // // Terminate the phase-specific modules // TerminateModules(); // // Terminate the process-wide modules: ETMs, transports // // Terminate Etm modules table // pFreeEtmTable (); // // Terminate all transport modules // pFreeTransportTable (); // // Enumerate all registered modules and verify that RefCount is 0 // pFreeRegisteredModules (); } BOOL IsmStartTransport ( VOID ) { INFSTRUCT is = INITINFSTRUCT_PMHANDLE; PCTSTR modulePath; PCTSTR moduleId; BOOL b = TRUE; BOOL cancelled = FALSE; if (CheckCancel ()) { return FALSE; } g_ExecutionInProgress = TRUE; MYASSERT (g_IsmInf != INVALID_HANDLE_VALUE); if (InfFindFirstLine (g_IsmInf, TEXT("Transport Modules"), NULL, &is)) { do { // // A transport module has an ID and module path // moduleId = InfGetStringField (&is, 0); modulePath = InfGetStringField (&is, 1); if (!ValidateModuleName (moduleId)) { LOG ((LOG_WARNING, (PCSTR) MSG_INVALID_ID, moduleId)); continue; } if (moduleId && modulePath) { // // Register the transport in an internal database // b = pRegisterTransport (moduleId, modulePath, NULL); cancelled = CheckCancel(); if (!b) { if (cancelled) { LOG ((LOG_MODULE_ERROR, (PCSTR) MSG_MODULE_RETURNED_FAILURE, moduleId)); break; } else { LOG ((LOG_INFORMATION, (PCSTR) MSG_IGNORE_MODULE, moduleId)); } } } } while (InfFindNextLine (&is)); } if (!cancelled) { InfCleanUpInfStruct (&is); if (!b) { pFreeTransportTable (); } } else { b = FALSE; } g_ExecutionInProgress = FALSE; return b; }
jiangshide/sdk
eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/RefactoringTest.java
/* * Copyright (C) 2011 The Android Open Source Project * * Licensed under the Eclipse Public License, Version 1.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.eclipse.org/org/documents/epl-v10.php * * 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 com.android.ide.eclipse.adt.internal.editors.layout.refactoring; import static com.android.SdkConstants.ANDROID_WIDGET_PREFIX; import static com.android.SdkConstants.DOT_XML; import com.android.ide.common.rendering.api.ViewInfo; import com.android.ide.eclipse.adt.AdtPlugin; import com.android.ide.eclipse.adt.internal.editors.layout.gle2.CanvasViewInfo; import com.android.ide.eclipse.adt.internal.editors.layout.gle2.DomUtilities; import com.android.ide.eclipse.adt.internal.editors.layout.uimodel.UiViewElementNode; import com.android.ide.eclipse.adt.internal.editors.uimodel.UiElementNode; import com.android.ide.eclipse.adt.internal.preferences.AdtPrefs; import org.eclipse.core.resources.IFile; import org.eclipse.core.runtime.IPath; import org.eclipse.jface.preference.IPreferenceStore; import org.eclipse.jface.text.BadLocationException; import org.eclipse.jface.text.Document; import org.eclipse.jface.text.IDocument; import org.eclipse.ltk.core.refactoring.Change; import org.eclipse.ltk.core.refactoring.TextFileChange; import org.eclipse.text.edits.MultiTextEdit; import org.eclipse.text.edits.TextEdit; import org.eclipse.wst.sse.core.StructuredModelManager; import org.eclipse.wst.sse.core.internal.provisional.IModelManager; import org.eclipse.wst.sse.core.internal.provisional.IStructuredModel; import org.eclipse.wst.sse.core.internal.provisional.IndexedRegion; import org.eclipse.wst.sse.core.internal.provisional.text.IStructuredDocument; import org.eclipse.wst.xml.core.internal.provisional.document.IDOMModel; import org.w3c.dom.Element; import java.io.IOException; import java.util.ArrayList; import java.util.Arrays; import java.util.Iterator; import java.util.List; import java.util.Map; import java.util.regex.Matcher; import java.util.regex.Pattern; @SuppressWarnings("restriction") public class RefactoringTest extends AdtProjectTest { protected boolean autoFormat() { return true; } @Override protected void setUp() throws Exception { // Ensure that the defaults are initialized so for example formatting options are // initialized properly IPreferenceStore store = AdtPlugin.getDefault().getPreferenceStore(); AdtPrefs.init(store); AdtPrefs prefs = AdtPrefs.getPrefs(); prefs.initializeStoreWithDefaults(store); store.setValue(AdtPrefs.PREFS_FORMAT_GUI_XML, autoFormat()); prefs.loadValues(null); super.setUp(); } protected static Element findElementById(Element root, String id) { if (id.equals(VisualRefactoring.getId(root))) { return root; } for (Element child : DomUtilities.getChildren(root)) { Element result = findElementById(child, id); if (result != null) { return result; } } return null; } protected static List<Element> getElements(Element root, String... ids) { List<Element> selectedElements = new ArrayList<Element>(); for (String id : ids) { Element element = findElementById(root, id); assertNotNull(element); selectedElements.add(element); } return selectedElements; } protected void checkEdits(String basename, List<Change> changes) throws BadLocationException, IOException { IDocument document = new Document(); String xml = readTestFile(basename, false); if (xml == null) { // New file xml = ""; //$NON-NLS-1$ } document.set(xml); for (Change change : changes) { if (change instanceof TextFileChange) { TextFileChange tf = (TextFileChange) change; TextEdit edit = tf.getEdit(); IFile file = tf.getFile(); String contents = AdtPlugin.readFile(file); assertEquals(contents, xml); if (edit instanceof MultiTextEdit) { MultiTextEdit edits = (MultiTextEdit) edit; edits.apply(document); } else { edit.apply(document); } } else { System.out.println("Ignoring non-textfilechange in refactoring result"); } } String actual = document.get(); // Ensure that the document is still valid to make sure the edits don't // mangle it: org.w3c.dom.Document doc = DomUtilities.parseDocument(actual, true); assertNotNull(actual, doc); assertEqualsGolden(basename, actual); } protected void checkEdits(List<Change> changes, Map<IPath, String> fileToGoldenName) throws BadLocationException, IOException { checkEdits(changes, fileToGoldenName, false); } protected void checkEdits(List<Change> changes, Map<IPath, String> fileToGoldenName, boolean createDiffs) throws BadLocationException, IOException { for (Change change : changes) { if (change instanceof TextFileChange) { TextFileChange tf = (TextFileChange) change; IFile file = tf.getFile(); assertNotNull(file); IPath path = file.getProjectRelativePath(); String goldenName = fileToGoldenName.get(path); assertNotNull("Not found: " + path.toString(), goldenName); String xml = readTestFile(goldenName, false); if (xml == null) { // New file xml = ""; //$NON-NLS-1$ } IDocument document = new Document(); document.set(xml); String before = document.get(); TextEdit edit = tf.getEdit(); if (edit instanceof MultiTextEdit) { MultiTextEdit edits = (MultiTextEdit) edit; edits.apply(document); } else { edit.apply(document); } String actual = document.get(); if (createDiffs) { // Use a diff as the golden file instead of the after actual = getDiff(before, actual); if (goldenName.endsWith(DOT_XML)) { goldenName = goldenName.substring(0, goldenName.length() - DOT_XML.length()) + ".diff"; } } assertEqualsGolden(goldenName, actual); } else { System.out.println("Ignoring non-textfilechange in refactoring result"); assertNull(change.getAffectedObjects()); } } } protected UiViewElementNode createModel(UiViewElementNode parent, Element element) { List<Element> children = DomUtilities.getChildren(element); String fqcn = ANDROID_WIDGET_PREFIX + element.getTagName(); boolean hasChildren = children.size() > 0; UiViewElementNode node = createNode(parent, fqcn, hasChildren); node.setXmlNode(element); for (Element child : children) { createModel(node, child); } return node; } /** * Builds up a ViewInfo hierarchy for the given model. This is done by * reading .info dump files which record the exact pixel sizes of each * ViewInfo object. These files are assumed to match up exactly with the * model objects. This is done rather than rendering an actual layout * hierarchy to insulate the test from pixel difference (in say font size) * among platforms, as well as tying the test to particulars about relative * sizes of things which may change with theme adjustments etc. * <p> * Each file can be generated by the dump method in the ViewHierarchy. */ protected ViewInfo createInfos(UiElementNode model, String relativePath) throws IOException { String basename = relativePath.substring(0, relativePath.lastIndexOf('.') + 1); String relative = basename + "info"; //$NON-NLS-1$ String info = readTestFile(relative, true); // Parse the info file and build up a model from it // Each line contains a new info. // If indented it is a child of the parent. String[] lines = info.split("\n"); //$NON-NLS-1$ // Iteration order for the info file should match exactly the UI model so // we can just advance the line index sequentially as we traverse return create(model, Arrays.asList(lines).iterator()); } protected ViewInfo create(UiElementNode node, Iterator<String> lineIterator) { // android.widget.LinearLayout [0,36,240,320] Pattern pattern = Pattern.compile("(\\s*)(\\S+) \\[(\\d+),(\\d+),(\\d+),(\\d+)\\].*"); assertTrue(lineIterator.hasNext()); String description = lineIterator.next(); Matcher matcher = pattern.matcher(description); assertTrue(matcher.matches()); //String indent = matcher.group(1); //String fqcn = matcher.group(2); String left = matcher.group(3); String top = matcher.group(4); String right = matcher.group(5); String bottom = matcher.group(6); ViewInfo view = new ViewInfo(node.getXmlNode().getLocalName(), node, Integer.parseInt(left), Integer.parseInt(top), Integer.parseInt(right), Integer.parseInt(bottom)); List<UiElementNode> childNodes = node.getUiChildren(); if (childNodes.size() > 0) { List<ViewInfo> children = new ArrayList<ViewInfo>(); for (UiElementNode child : childNodes) { children.add(create(child, lineIterator)); } view.setChildren(children); } return view; } protected TestContext setupTestContext(IFile file, String relativePath) throws Exception { IStructuredModel structuredModel = null; org.w3c.dom.Document domDocument = null; IStructuredDocument structuredDocument = null; Element element = null; try { IModelManager modelManager = StructuredModelManager.getModelManager(); structuredModel = modelManager.getModelForRead(file); if (structuredModel instanceof IDOMModel) { IDOMModel domModel = (IDOMModel) structuredModel; domDocument = domModel.getDocument(); element = domDocument.getDocumentElement(); structuredDocument = structuredModel.getStructuredDocument(); } } finally { if (structuredModel != null) { structuredModel.releaseFromRead(); } } assertNotNull(structuredModel); assertNotNull(domDocument); assertNotNull(element); assertNotNull(structuredDocument); assertTrue(element instanceof IndexedRegion); UiViewElementNode model = createModel(null, element); ViewInfo info = createInfos(model, relativePath); CanvasViewInfo rootView = CanvasViewInfo.create(info, true /* layoutlib5 */).getFirst(); TestLayoutEditorDelegate layoutEditor = new TestLayoutEditorDelegate(file, structuredDocument, null); TestContext testInfo = createTestContext(); testInfo.mFile = file; testInfo.mStructuredModel = structuredModel; testInfo.mStructuredDocument = structuredDocument; testInfo.mElement = element; testInfo.mDomDocument = domDocument; testInfo.mUiModel = model; testInfo.mViewInfo = info; testInfo.mRootView = rootView; testInfo.mLayoutEditorDelegate = layoutEditor; return testInfo; } protected TestContext createTestContext() { return new TestContext(); } protected static class TestContext { protected IFile mFile; protected IStructuredModel mStructuredModel; protected IStructuredDocument mStructuredDocument; protected org.w3c.dom.Document mDomDocument; protected Element mElement; protected UiViewElementNode mUiModel; protected ViewInfo mViewInfo; protected CanvasViewInfo mRootView; protected TestLayoutEditorDelegate mLayoutEditorDelegate; } @Override public void testDummy() { // To avoid JUnit warning that this class contains no tests, even though // this is an abstract class and JUnit shouldn't try } }
wyaadarsh/LeetCode-Solutions
Python3/0811-Subdomain-Visit-Count/soln.py
<reponame>wyaadarsh/LeetCode-Solutions class Solution(object): def subdomainVisits(self, cpdomains): """ :type cpdomains: List[str] :rtype: List[str] """ counter = collections.Counter() for item in cpdomains: num, url = item.split() num = int(num) i = 0 while True: counter[url[i:]] += num j = url.find('.', i) if j == -1: break else: i = j + 1 return ['{} {}'.format(cnt, key) for key, cnt in counter.items()]
darobin/critic
installation/database.py
<filename>installation/database.py # -*- mode: python; encoding: utf-8 -*- # # Copyright 2012 <NAME>, Opera Software ASA # # 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. import tempfile import shutil import os import time import errno import subprocess import installation user_created = False database_created = False language_created = False def psql_import(sql_file): temp_file = tempfile.mkstemp()[1] shutil.copy(sql_file, temp_file) # Make sure file is readable by postgres user os.chmod(temp_file, 0644) subprocess.check_output(["su", "-s", "/bin/sh", "-c", "psql -v ON_ERROR_STOP=1 -f %s" % temp_file, installation.system.username]) os.unlink(temp_file) def add_arguments(mode, parser): if mode == "upgrade": parser.add_argument("--backup-database", dest="database_backup", action="store_const", const=True, help="backup database to default location without asking") parser.add_argument("--no-backup-database", dest="database_backup", action="store_const", const=False, help="do not backup database before upgrading") def prepare(mode, arguments, data): if mode == "upgrade": default_path = os.path.join(data["installation.paths.data_dir"], "backups", time.strftime("%Y%m%d_%H%M.dump", time.localtime())) if arguments.database_backup is False: backup_database = False elif arguments.database_backup is True: backup_database = True backup_path = default_path else: if installation.migrate.will_modify_dbschema(data): print """ The database schema will be modified by the upgrade. Creating a backup of the database first is strongly recommended. """ default_backup = True else: default_backup = False if installation.input.yes_or_no("Do you want to create a backup of the database?", default=default_backup): backup_database = True backup_path = installation.input.string("Where should the backup be stored?", default=default_path) else: backup_database = False if backup_database: try: os.makedirs(os.path.dirname(backup_path), 0750) except OSError as error: if error.errno == errno.EEXIST: pass else: raise print print "Dumping database ..." with open(backup_path, "w") as output_file: subprocess.check_call( ["su", "-s", "/bin/sh", "-c", "pg_dump -Fc critic", data["installation.system.username"]], stdout=output_file) print "Compressing database dump ..." print subprocess.check_call(["bzip2", backup_path]) return True def install(data): global user_created, database_created, language_created print "Creating database ..." # Several subsequent commands will run as Critic system user or "postgres" user, # and these users typically don't have read access to the installation 'root_dir' original_dir = os.getcwd() try: # Set cwd to something that Critic system / "postgres" users has access to. os.chdir(tempfile.gettempdir()) subprocess.check_output(["su", "-c", "psql -v ON_ERROR_STOP=1 -c 'CREATE USER \"%s\";'" % installation.system.username, "postgres"]) user_created = True subprocess.check_output(["su", "-c", "psql -v ON_ERROR_STOP=1 -c 'CREATE DATABASE \"critic\";'", "postgres"]) database_created = True try: subprocess.check_output(["su", "-c", "createlang plpgsql critic", "postgres"], stderr=subprocess.STDOUT) language_created = True except subprocess.CalledProcessError: # The 'createlang' command fails if the language is already enabled # in the database, and we want to ignore such failures. It might # also fail for other reasons, that we really don't mean to ignore, # but in that case importing the *.pgsql files below would fail, # since they define PL/pgSQL functions. pass subprocess.check_output(["su", "-c", "psql -v ON_ERROR_STOP=1 -c 'GRANT ALL ON DATABASE \"critic\" TO \"%s\";'" % installation.system.username, "postgres"]) data_dir = os.path.join(installation.root_dir, "installation/data") psql_import(os.path.join(data_dir, "dbschema.sql")) psql_import(os.path.join(data_dir, "dbschema.comments.sql")) psql_import(os.path.join(data_dir, "comments.pgsql")) psql_import(os.path.join(data_dir, "roles.sql")) import psycopg2 def adapt(value): return psycopg2.extensions.adapt(value).getquoted() if installation.config.access_scheme in ("http", "https"): anonymous_scheme = authenticated_scheme = installation.config.access_scheme else: anonymous_scheme = "http" authenticated_scheme = "https" add_systemidentity_query = ( """INSERT INTO systemidentities (key, name, anonymous_scheme, authenticated_scheme, hostname, description, installed_sha1) VALUES ('main', 'main', %s, %s, %s, 'Main', %s);""" % (adapt(anonymous_scheme), adapt(authenticated_scheme), adapt(installation.system.hostname), adapt(data["sha1"]))) installation.process.check_input( ["su", "-s", "/bin/sh", "-c", "psql -q -v ON_ERROR_STOP=1 -f -", installation.system.username], stdin=add_systemidentity_query) finally: os.chdir(original_dir) return True def undo(): if language_created: subprocess.check_output(["su", "-c", "droplang plpgsql critic", "postgres"]) if database_created: subprocess.check_output(["su", "-c", "psql -v ON_ERROR_STOP=1 -c 'DROP DATABASE \"critic\";'", "postgres"]) if user_created: subprocess.check_output(["su", "-c", "psql -v ON_ERROR_STOP=1 -c 'DROP USER \"%s\";'" % installation.system.username, "postgres"])
sorasful/minos-python
packages/core/minos-microservice-saga/tests/test_saga/test_exceptions.py
import unittest from minos.common import ( MinosException, ) from minos.saga import ( AlreadyOnSagaException, EmptySagaStepException, MultipleOnErrorException, MultipleOnExecuteException, MultipleOnFailureException, MultipleOnSuccessException, SagaException, SagaExecutionException, SagaExecutionNotFoundException, SagaFailedExecutionStepException, SagaNotDefinedException, SagaPausedExecutionStepException, SagaRollbackExecutionException, SagaRollbackExecutionStepException, SagaStepException, SagaStepExecutionException, UndefinedOnExecuteException, ) class TestExceptions(unittest.TestCase): def test_type(self): self.assertTrue(issubclass(SagaException, MinosException)) def test_step(self): self.assertTrue(issubclass(SagaStepException, MinosException)) def test_step_saga_not_defined(self): self.assertTrue(issubclass(SagaNotDefinedException, SagaStepException)) def test_step_saga_not_defined_repr(self): expected = ( "SagaNotDefinedException(message=\"A 'SagaStep' " "must have a 'Saga' instance to call call this method.\")" ) self.assertEqual(expected, repr(SagaNotDefinedException())) def test_step_empty(self): self.assertTrue(issubclass(EmptySagaStepException, SagaStepException)) def test_step_empty_repr(self): expected = "EmptySagaStepException(message=\"A 'SagaStep' must have at least one defined action.\")" self.assertEqual(expected, repr(EmptySagaStepException())) def test_step_multiple_on_execute(self): self.assertTrue(issubclass(MultipleOnExecuteException, SagaStepException)) def test_step_multiple_on_execute_repr(self): expected = "MultipleOnExecuteException(message=\"A 'SagaStep' can " "only define one 'on_execute' method.\")" self.assertEqual(expected, repr(MultipleOnExecuteException())) def test_step_multiple_on_failure(self): self.assertTrue(issubclass(MultipleOnFailureException, SagaStepException)) def test_step_multiple_on_failure_repr(self): expected = "MultipleOnFailureException(message=\"A 'SagaStep'" " can only define one 'on_failure' method.\")" self.assertEqual(expected, repr(MultipleOnFailureException())) def test_step_multiple_on_success(self): self.assertTrue(issubclass(MultipleOnSuccessException, SagaStepException)) def test_step_multiple_on_success_repr(self): expected = "MultipleOnSuccessException(message=\"A 'SagaStep' can only define one 'on_success' method.\")" self.assertEqual(expected, repr(MultipleOnSuccessException())) def test_step_multiple_on_error(self): self.assertTrue(issubclass(MultipleOnErrorException, SagaStepException)) def test_step_multiple_on_error_repr(self): expected = "MultipleOnErrorException(message=\"A 'SagaStep' can only define one 'on_error' method.\")" self.assertEqual(expected, repr(MultipleOnErrorException())) def test_step_already_on_saga(self): self.assertTrue(issubclass(AlreadyOnSagaException, SagaStepException)) def test_step_already_on_saga_repr(self): expected = "AlreadyOnSagaException(message=\"A 'SagaStep' can only belong to one 'Saga' simultaneously.\")" self.assertEqual(expected, repr(AlreadyOnSagaException())) def test_step_undefined_on_execute(self): self.assertTrue(issubclass(UndefinedOnExecuteException, SagaStepException)) def test_step_undefined_on_execute_repr(self): expected = ( "UndefinedOnExecuteException(message=\"A 'SagaStep' " "must define at least the 'on_execute' logic.\")" ) self.assertEqual(expected, repr(UndefinedOnExecuteException())) def test_execution(self): self.assertTrue(issubclass(SagaExecutionException, MinosException)) def test_execution_not_found(self): self.assertTrue(issubclass(SagaExecutionNotFoundException, MinosException)) def test_execution_rollback(self): self.assertTrue(issubclass(SagaRollbackExecutionException, SagaExecutionException)) def test_execution_step(self): self.assertTrue(issubclass(SagaStepExecutionException, MinosException)) def test_execution_step_failed_step(self): self.assertTrue(issubclass(SagaFailedExecutionStepException, SagaStepExecutionException)) def test_execution_step_failed_step_repr(self): expected = ( 'SagaFailedExecutionStepException(message="There was ' "a failure while 'SagaStepExecution' was executing: ValueError('test')\")" ) self.assertEqual(expected, repr(SagaFailedExecutionStepException(ValueError("test")))) def test_execution_step_paused_step(self): self.assertTrue(issubclass(SagaPausedExecutionStepException, SagaStepExecutionException)) def test_execution_step_paused_step_repr(self): expected = ( 'SagaPausedExecutionStepException(message="There was ' "a pause while 'SagaStepExecution' was executing.\")" ) self.assertEqual(expected, repr(SagaPausedExecutionStepException())) def test_execution_step_rollback(self): self.assertTrue(issubclass(SagaRollbackExecutionStepException, SagaStepExecutionException)) if __name__ == "__main__": unittest.main()
GSTJ/XPerion
packages/mobile/src/views/home/styles.js
import styled from 'styled-components/native'; import LinearGradient from 'react-native-linear-gradient'; import {Map as map} from 'components/molecules'; import {TEXT, LOWER_CONTRAST} from 'theme'; export const SearchContainer = styled.View` height: 55; margin-bottom: 10px; border: 1px solid ${LOWER_CONTRAST}; border-radius: 10px; flex-direction: row; align-items: center; padding-right: 20px; `; export const Search = styled.TextInput` padding-left: 20px; padding-right: 20px; color: ${TEXT}; font-family: 'Montserrat Medium'; font-size: 17px; flex: 1; `; export const Container = styled(LinearGradient)` border-radius: 20px; border-bottom-right-radius: 0; border-bottom-left-radius: 0; padding: 15px 15px 0 15px; flex: 1; `; export const ScrollContainer = styled.View` border-radius: 10px; border-bottom-right-radius: 0; border-bottom-left-radius: 0; flex: 1; overflow: hidden; `; export const Map = styled(map)` width: 100%; height: 100%; position: absolute; top: 0; left: 0; `;
Myweik/MMC_qgroundcontrol
MMC/qtavplayer/src/QmlVideoObject.cpp
<reponame>Myweik/MMC_qgroundcontrol<filename>MMC/qtavplayer/src/QmlVideoObject.cpp /**************************************************************************** * VLC-Qt - Qt and libvlc connector library * Copyright (C) 2013 <NAME> <<EMAIL>> * * Based on Phonon multimedia library * Copyright (C) 2011 <NAME> <<EMAIL>> * * This library is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published * by the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this library. If not, see <http://www.gnu.org/licenses/>. *****************************************************************************/ //#include "VLCQtCore/MediaPlayer.h" #include "QmlVideoObject.h" #include <QTimer> #include <QByteArray> #include <QBuffer> VlcQmlVideoObject::VlcQmlVideoObject(QQuickItem *parent) : QQuickPaintedItem(parent), _geometry(0, 0, 640, 480), _boundingRect(0, 0, 0, 0), _frameSize(0, 0), _graphicsPainter(0), _paintedOnce(false), _gotSize(false), _aspectRatio(Vlc::Original), _cropRatio(Vlc::Original), _decoder(new AVDecoder) { setRenderTarget(InvertedYFramebufferObject); setFlag(ItemHasContents, true); _decoder->setMediaCallback(this); } VlcQmlVideoObject::~VlcQmlVideoObject() { qDebug() << "----------------------VlcQmlVideoObject::~VlcQmlVideoObject"; if (_graphicsPainter) delete _graphicsPainter; if(_decoder) delete _decoder; } QRectF VlcQmlVideoObject::boundingRect() const { return _boundingRect; } void VlcQmlVideoObject::updateBoundingRect() { _boundingRect = QRectF(0, 0, _frameSize.width(), _frameSize.height()); updateAspectRatio(); QSizeF scaledFrameSize = _boundingRect.size(); if (_aspectRatio == Vlc::Ignore) { scaledFrameSize.scale(_geometry.size(), Qt::IgnoreAspectRatio); } else { scaledFrameSize.scale(_geometry.size(), Qt::KeepAspectRatio); } _boundingRect.setSize( scaledFrameSize ); updateCropRatio(); _boundingRect.moveCenter(_geometry.center()); } void VlcQmlVideoObject::updateAspectRatio() { QSizeF ar = Vlc::ratioSize( _aspectRatio ); if( ar.width() != 0 && ar.height() != 0) { qreal ratio = qMin( _boundingRect.width() / ar.width() , _boundingRect.height() / ar.height() ); _boundingRect.setWidth( (qreal) ratio * ar.width() ); _boundingRect.setHeight( (qreal) ratio * ar.height() ); } } void VlcQmlVideoObject::updateCropRatio() { QSizeF ar = Vlc::ratioSize( _cropRatio ); if( ar.width() != 0 && ar.height() != 0) { QRectF cropRect = _boundingRect; qreal ratio = qMin( cropRect.width() / ar.width() , cropRect.height() / ar.height() ); cropRect.setWidth( (qreal) ratio * ar.width() ); cropRect.setHeight( (qreal) ratio * ar.height() ); QSizeF scaledFrameSize = cropRect.size(); scaledFrameSize.scale(_geometry.size(), Qt::KeepAspectRatio); _boundingRect.setWidth( _boundingRect.width() * ( scaledFrameSize.width() / cropRect.width() ) ); _boundingRect.setHeight( _boundingRect.height() * ( scaledFrameSize.height() / cropRect.height() ) ); } } Vlc::Ratio VlcQmlVideoObject::cropRatio() const { return _cropRatio; } void VlcQmlVideoObject::setCropRatio(const Vlc::Ratio &cropRatio) { _cropRatio = cropRatio; updateBoundingRect(); } Vlc::Ratio VlcQmlVideoObject::aspectRatio() const { return _aspectRatio; } void VlcQmlVideoObject::setAspectRatio(const Vlc::Ratio &aspectRatio) { _aspectRatio = aspectRatio; updateBoundingRect(); } void VlcQmlVideoObject::paint(QPainter *painter) { lock(); if( _frame.inited ) { if (!_graphicsPainter) _graphicsPainter = new GlslPainter; Q_ASSERT(_graphicsPainter); _gotSize = false; if (!_gotSize || _frameSize.isNull()) { // TODO: do scaling ourselfs? _gotSize = true; _frameSize = QSize(_frame.width, _frame.height); updateBoundingRect(); } if (!_paintedOnce) { painter->fillRect(_boundingRect, Qt::black); _paintedOnce = true; } else { Q_ASSERT(_graphicsPainter); _graphicsPainter->setFrame(&_frame); if (!_graphicsPainter->inited()) _graphicsPainter->init(); _graphicsPainter->paint(painter, _boundingRect, this); //显示 } }else{ qDebug() << "----------------------------------------unlock"; } // _frame.inited = false; unlock(); } void VlcQmlVideoObject::geometryChanged(const QRectF &newGeometry, const QRectF &oldGeometry) { _geometry = newGeometry; updateBoundingRect(); QQuickPaintedItem::geometryChanged(newGeometry, oldGeometry); } void VlcQmlVideoObject::frameReady() { update(); } void VlcQmlVideoObject::reset() { // Do not reset the spyFormats as they will not change. _paintedOnce = false; _gotSize = false; // The painter is reset because the backend may choose another format for // another file (better conversion for some codec etc.) if (_graphicsPainter) { delete _graphicsPainter; _graphicsPainter = 0; } } //void VlcQmlVideoObject::connectToMediaPlayer(VlcMediaPlayer *player) //{ // setCallbacks(player); //} //void VlcQmlVideoObject::disconnectFromMediaPlayer(VlcMediaPlayer *player) //{ // // Try to prevent callbacks called after this object is being deleted // if (player) { // player->stop(); // } // unsetCallbacks(player); //} void VlcQmlVideoObject::lock() { _mutex.lock(); } bool VlcQmlVideoObject::tryLock() { return _mutex.tryLock(); } void VlcQmlVideoObject::unlock() { _mutex.unlock(); } void *VlcQmlVideoObject::lockCallback(void **planes) { lock(); *planes = &_frame; // for (unsigned int i = 0; i < _frame.planeCount; ++i) { // planes[i] = reinterpret_cast<void *>(_frame.plane[i].data()); // } return 0; // There is only one buffer, so no need to identify it. } void VlcQmlVideoObject::unlockCallback() { unlock(); // To avoid thread polution do not call frameReady directly, but via the // event loop. QMetaObject::invokeMethod(this, "frameReady", Qt::QueuedConnection); } void VlcQmlVideoObject::formatCleanUpCallback() { _frame.inited = false; // To avoid thread polution do not call reset directly but via the event loop. QMetaObject::invokeMethod(this, "reset", Qt::QueuedConnection); }
liuning19861103/NavOS_C
Sources/VSSim/SimParSet.h
<reponame>liuning19861103/NavOS_C<gh_stars>0 /***************************************************************** * @brief: * @File: * @Project: * @Author: * @Date: * @CopyRight: * @Version: * @Description: *****************************************************************/ #ifndef __SIMPARSET_H #define __SIMPARSET_H #if defined(STM_RUN) #if defined(STM32F429xx) #include "stm32f4xx_hal.h" #elif defined(STM32F767xx) #include "stm32f7xx_hal.h" #endif #elif defined(VS_SIM) #define HAL #endif #endif
ameli/TraceInv
imate/_trace_estimator/trace_estimator_plot_utilities.py
# SPDX-FileCopyrightText: Copyright 2021, <NAME> <<EMAIL>> # SPDX-License-Identifier: BSD-3-Clause # SPDX-FileType: SOURCE # # This program is free software: you can redistribute it and/or modify it # under the terms of the license found in the LICENSE.txt file in the root # directory of this source tree. # ======= # Imports # ======= import numpy import scipy.special try: from .._utilities.plot_utilities import matplotlib, plt from .._utilities.plot_utilities import load_plot_settings, save_plot plot_modules_exist = True except ImportError: plot_modules_exist = False __all__ = ['plot_convergence'] # =============== # remove outliers # =============== def _remove_outliers( samples, samples_processed_order, num_samples_used, outlier_confidence_level): """ Flags the outlier samples and sets them to nan. The outlier is defined by those sample points that are outside of the confidence region defined by a confidence level. :param samples: 2D array of size ``(max_num_samples, num_inquiry)``. Each column is the set of all samples for an inquiry. Some of these samples might be nan, because, often, the convergence is achieved sooner than ``max_num_samples``, hence, with the fewer number of processed rows, the remaining elements in a row remain nan. :type: numpy.ndarray :param samples_processed_order: Due to parallel processing, the rows of the ``samples`` array are not processed sequentially. This 1D array of size ``max_num_samples`` keeps the record of the process order of the rows of ``samples``. :type samples_process_order: numpy.ndarray :param num_samples_used: 1D array of size ``num_inquiry``. The j-th element is the number of valid (non-nan) rows of the j-th column of ``samples``. Thus, it indicates how many samples exists for the j-th inquiry out of the max number of samples. :type num_samples_used: numpy.ndarray :param outlier_confidence_level: The confidence level of the outlier, which is between ``0`` and ``1``. For example, the confidence level of ``0.001`` means that the outliers are in the 1% area of the both ends of the tails of the normal distribution. When this value is zero, no outlier will be detected and removed. A larger level will flag more points as outlier. :type confidence_level: float :return: Returns two arrays: * ``cleaned_smaples``: an array copied from ``samples``, but the outliers are converted to ``numpy.nan``. * ``outlier_indices``: a boolean array of the same shape as ``samples`` where the flagged outliers are set to True. : rtype: tuple (numpy.ndarray) """ num_inquiries = samples.shape[1] outlier_indices = numpy.zeros(samples.shape, dtype=bool) cleaned_samples = numpy.copy(samples) # Quantile of the region that is "not" considered as outlier non_outlier_confidence_level = 1.0 - outlier_confidence_level outlier_quantile = \ numpy.sqrt(2) * scipy.special.erfinv(non_outlier_confidence_level) for j in range(num_inquiries): sample_indices = samples_processed_order[:num_samples_used[j]] valid_samples = samples[sample_indices, j] # Mean and std of the j-th column of samples mean = numpy.nanmean(valid_samples) std = numpy.nanstd(valid_samples) # Find those samples outside of the confidence region difference = numpy.abs(samples[:, j] - mean) outlier_indices[:, j] = \ (difference > outlier_quantile * std).astype(bool) # Remove outliers cleaned_samples[outlier_indices[:, j], j] = numpy.nan return cleaned_samples, outlier_indices # ============================= # compute cumulative statistics # ============================= def _compute_cumulative_statistics( samples, samples_processed_order, num_samples_used, confidence_level): """ Computes mean and error as the number of samples progresses. The output are the means, absolute and relative errors of the samples. The cumulative here refers to the progressive mean or error of the samples from the first to the current row as the row progresses by introducing more rows to the samples data. For example, the i-th row and j-th column of the cumulative mean is the mean of rows 0:i-1 and j-th column of samples. :param samples: 2D array of size ``(max_num_samples, num_inquiry)``. Each column is the set of all samples for an inquiry. Some of these samples might be nan, because, often, the convergence is achieved sooner than ``max_num_samples``, hence, with the fewer number of processed rows, the remaining elements in a row remain nan. :type: numpy.ndarray :param samples_processed_order: Due to parallel processing, the rows of the ``samples`` array are not processed sequentially. This 1D array of size ``max_num_samples`` keeps the record of the process order of the rows of ``samples``. :type samples_process_order: numpy.ndarray :param num_samples_used: 1D array of size ``num_inquiry``. The j-th element is the number of valid (non-nan) rows of the j-th column of ``samples``. Thus, it indicates how many samples exists for the j-th inquiry out of the max number of samples. :type num_samples_used: numpy.ndarray :param confidence_level: The confidence level of the error, which is between ``0`` and ``1``. For example, the confidence level of ``0.95`` means that the confidence region consists of 95% of the area under the normal distribution of the samples. :type confidence_level: float :return: A list of cumulative mean, absolute error, and relative error. Each of these three arrays have the same shape as ``samples``. :rtype: list """ # Allocate arrays cumulative_mean = numpy.empty_like(samples) cumulative_abs_error = numpy.empty_like(samples) cumulative_rel_error = numpy.empty_like(samples) # Set arrays to nan cumulative_mean[:, :] = numpy.nan cumulative_abs_error[:, :] = numpy.nan cumulative_rel_error[:, :] = numpy.nan # Quantile based on the confidence level quantile = numpy.sqrt(2) * scipy.special.erfinv(confidence_level) num_inquiries = samples.shape[1] for j in range(num_inquiries): for i in range(num_samples_used[j]): # Find the non-nan elements of the j-th column of samples from the # first to the i-th processed element sample_indices = samples_processed_order[:i+1] samples_valid = samples[sample_indices, j] samples_valid = samples_valid[~numpy.isnan(samples_valid)] if samples_valid.size == 0: # This might happen on the first processed row cumulative_mean[i, j] = numpy.nan cumulative_abs_error[i, j] = numpy.nan cumulative_rel_error[i, j] = numpy.nan else: # Compute mean and errors cumulative_mean[i, j] = numpy.nanmean(samples_valid) standard_deviation = numpy.nanstd(samples_valid) cumulative_abs_error[i, j] = \ quantile * standard_deviation / numpy.sqrt(i+1) cumulative_rel_error[i, j] = \ cumulative_abs_error[i, j] / cumulative_mean[i, j] return cumulative_mean, cumulative_abs_error, cumulative_rel_error # ============ # plot samples # ============ def _plot_samples( ax, samples, samples_processed_order, num_samples_used, confidence_level, cumulative_mean, cumulative_abs_error): """ When ``num_inquiries`` is ``1``, this function is called to plot the samples and their cumulative mean. When ``num_inquiries`` is more than one, the samples of different inquiries cannot be plotted in the same axes since the value of trace might be very difference for each case. :param ax: axes object :type ax: numpy.ndarray :param samples: 2D array of size ``(max_num_samples, num_inquiry)``. Each column is the set of all samples for an inquiry. Some of these samples might be nan, because, often, the convergence is achieved sooner than ``max_num_samples``, hence, with the fewer number of processed rows, the remaining elements in a row remain nan. :type: numpy.ndarray :param samples_processed_order: Due to parallel processing, the rows of the ``samples`` array are not processed sequentially. This 1D array of size ``max_num_samples`` keeps the record of the process order of the rows of ``samples``. :type samples_process_order: numpy.ndarray :param num_samples_used: 1D array of size ``num_inquiry``. The j-th element is the number of valid (non-nan) rows of the j-th column of ``samples``. Thus, it indicates how many samples exists for the j-th inquiry out of the max number of samples. Note that this is different than ``num_samples_processed``, because the j-th column might converge sooner than others and thus, less number of samples were used for it. :type num_samples_used: numpy.ndarray :param confidence_level: The confidence level of the error, which is between ``0`` and ``1``. For example, the confidence level of ``0.95`` means that the confidence region consists of 95% of the area under the normal distribution of the samples. :type confidence_level: float :param cumulative_mean: 2D array of size ``(max_num_samples, num_inqiries). :type cumulative_mean: numpy.ndarray :param cumulative_abs_error: 2D array of size ``(max_num_samples, num_inqiries). :type cumulative_abs_error: numpy.ndarray """ if not plot_modules_exist: raise ImportError('Cannot import modules for plotting. Either ' + 'install "matplotlib" and "seaborn" packages, ' + 'or set "plot=False".') # Load plot settings try: load_plot_settings() except ImportError: raise ImportError('Cannot import modules for plotting. Either ' + 'install "matplotlib" and "seaborn" packages, ' + 'or set "plot=False".') # If samples has multiple columns, only the first column (inquiry) plotted. inquiry = 0 # abscissa x = 1 + numpy.arange(num_samples_used[inquiry]) # Reorder rows of samples in the same order as they were processed rows_order = samples_processed_order[:num_samples_used[inquiry]] _samples = samples[rows_order, inquiry] # No need to reorder the rows of cumulative mean and error, since, when # they were computed in :func:`compute_cumulative_statistics` function, # they were reordered already. _mean = cumulative_mean[:num_samples_used[inquiry], inquiry] _abs_error = cumulative_abs_error[:num_samples_used[inquiry], inquiry] # Plot samples as points ax.plot(x, _samples, 'o', markersize=4, color='grey', label='estimates') # Plot cumulative mean ax.plot(x, _mean, color='black', label='mean') # Plot confidence region ax.fill_between(x, _mean - _abs_error, _mean + _abs_error, color='black', alpha=0.25, label=('%s' % str(100.0*confidence_level).strip('.0')) + r'$\%$ confidence region') ax.set_xlabel('sample index') ax.set_ylabel('trace estimates') ax.set_title('Stochastic Estimates and Mean of Samples') ax.set_xlim([x[0], x[-1]]) ax.legend() # Ensure x ticks are integers ax.xaxis.set_major_locator(matplotlib.ticker.MaxNLocator(integer=True)) # ========== # plot error # ========== def _plot_error( ax, num_samples_used, min_num_samples, max_num_samples, error_atol, error_rtol, converged, cumulative_abs_error, cumulative_rel_error): """ Plots cumulative errors. When ``num_inquiries`` is ``1``, it plots both absolute and relative errors (on left and right y axes) on the same axes. However, when ``num_inquiries`` is more than one, it only plots the relative error. This is because, with the multiple number of inquiries, the absolute error of each can be on different plot scales and they cannot be contained in the same scale of the plot. :param ax: axes object :type ax: numpy.ndarray :param num_samples_used: 1D array of size ``num_inquiry``. The j-th element is the number of valid (non-nan) rows of the j-th column of ``samples``. Thus, it indicates how many samples exists for the j-th inquiry out of the max number of samples. Note that this is different than ``num_samples_processed``, because the j-th column might converge sooner than others and thus, less number of samples were used for it. :type num_samples_used: numpy.ndarray :param min_num_samples: Minimum number of samples. In the iterations below this number, the convergence is now checked. :type min_num_samples: int :param max_num_samples: Maximum number of samples. This is also the number of row of ``samples`` array. :type max_num_samples: int :param error_atol: Absolute error tolerance :type error_atol: float :param error_rtol: Relative error tolerance :type error_rtol: float :param converged: 1D boolean array of size ``num_inquiries`` and indicates which of the inquiries are converged at their final state. :type converged: numpy.ndarray :param cumulative_abs_error: 2D array of size ``(max_num_samples, num_inqiries). :type cumulative_abs_error: numpy.ndarray :param cumulative_rel_error: 2D array of size ``(max_num_samples, num_inqiries). :type cumulative_rel_error: numpy.ndarray """ if not plot_modules_exist: raise ImportError('Cannot import modules for plotting. Either ' + 'install "matplotlib" and "seaborn" packages, ' + 'or set "plot=False".') # Load plot settings try: load_plot_settings() except ImportError: raise ImportError('Cannot import modules for plotting. Either ' + 'install "matplotlib" and "seaborn" packages, ' + 'or set "plot=False".') relative_color = 'black' absolute_color = 'darkgrey' num_inquiries = cumulative_abs_error.shape[1] if num_inquiries == 1: ax2 = ax.twinx() # Scale the twin y axis (for absolute error) so that the final value of # the relative and absolute plots match max_rel_error = numpy.nanmax(numpy.nanmax(cumulative_rel_error)) * 100.0 final_abs_error = cumulative_abs_error[num_samples_used[0]-1, 0] final_rel_error = cumulative_rel_error[num_samples_used[0]-1, 0] * 100.0 # Match the high of the final value of the absolute error with relative ylim_abs_plot = final_abs_error * max_rel_error / final_rel_error # Extra space for the y axis limit ylim_scale = 1.1 x_min = 1 x_max = numpy.max(num_samples_used) # Colormaps if num_inquiries > 1: # Concatenate two colormaps, in total, 18 colors colors1 = matplotlib.cm.tab10.colors colors2 = matplotlib.cm.Dark2.colors colors = numpy.r_[colors1, colors2] else: colors = ['black'] for inquiry in range(num_inquiries): # Abscissa x = 1 + numpy.arange(num_samples_used[inquiry]) # Get relative and absolute errors for each inquiry _num_samples_used = num_samples_used[inquiry] _rel_error = cumulative_rel_error[:_num_samples_used, inquiry] * 100.0 _abs_error = cumulative_abs_error[:_num_samples_used, inquiry] # With more than one inquiry, do not plot absolute error if num_inquiries == 1: ax2.plot(x, _abs_error, color=absolute_color, label='absolute error') ax.plot(x, _rel_error, color=relative_color, label='relative error') else: ax.plot(x, _rel_error, color=colors[inquiry], label='inquiry: %d' % (inquiry+1)) # Relative error tolerance limit line ax.plot([x_min, max_num_samples], [error_rtol, error_rtol], '--', color=relative_color, label='relative error tol') if num_inquiries == 1: # Absolute error tolerance limit line ax2.plot([x_min, max_num_samples], [error_atol, error_atol], '--', color=absolute_color, label='absolute error tol') # Vertical dotted line showing where the min_num_samples starts ax.plot([min_num_samples, min_num_samples], [0., max_rel_error*ylim_scale], ':', color='grey', label='min num samples') # Plot a dot at each converged point dot_label_inserted = False for inquiry in range(num_inquiries): x = 1 + numpy.arange(num_samples_used[inquiry]) _num_samples_used = num_samples_used[inquiry] _rel_error = cumulative_rel_error[:_num_samples_used, inquiry] * 100.0 _abs_error = cumulative_abs_error[:_num_samples_used, inquiry] if converged[inquiry]: # Insert a label for dot only once if not dot_label_inserted: dot_label_inserted = True ax.plot(x[-1], _rel_error[-1], 'o', color=colors[inquiry], zorder=20, markersize=4, label='convergence reached') else: ax.plot(x[-1], _rel_error[-1], 'o', color=colors[inquiry], zorder=20, markersize=4) # Before min_num_samples and after max_num_samples, shade plot background ax.axvspan(x_min, min_num_samples, color='grey', alpha=0.2, lw=0, label='convergence skipped') ax.axvspan(x_max, max_num_samples, color='grey', alpha=0.07, lw=0) ax.set_xlabel('sample index') ax.set_ylabel('relative error') ax.set_title('Convergence of Errors') ax.set_xlim([x_min, max_num_samples]) ax.set_ylim([0, max_rel_error*ylim_scale]) # Display yticks as percent ax.yaxis.set_major_formatter(matplotlib.ticker.PercentFormatter()) # Ensure x ticks are integers ax.xaxis.set_major_locator(matplotlib.ticker.MaxNLocator(integer=True)) if num_inquiries == 1: ax2.set_ylabel('absolute error') ax2.set_ylim([0, ylim_abs_plot*ylim_scale]) # Legend lines, labels = ax.get_legend_handles_labels() if num_inquiries == 1: # With one inquiry, legend contains both relative and absolute plots # where each correspond to the left and right (twin) axis lines2, labels2 = ax2.get_legend_handles_labels() all_lines = lines + lines2 all_labels = labels + labels2 ax.legend(all_lines, all_labels) elif num_inquiries < 11: # With less than 11 inquiries, use single column legend ax.legend(lines, labels, bbox_to_anchor=(1.01, 1.022), loc='upper left') else: # With equal or more than 11 inquiries, use two column legend ax.legend(lines, labels, bbox_to_anchor=(1.01, 1.022), loc='upper left', ncol=2) # Bring the plots of the original axis above the plots of the twin axis ax.set_zorder(1) ax.patch.set_visible(False) # ================ # plot convergence # ================ def plot_convergence(info): """ Plots samples, cumulative mean, absolute and relative error. :param info: A dictionary of all output info. :type: dict """ if not plot_modules_exist: raise ImportError('Cannot import modules for plotting. Either ' + 'install "matplotlib" and "seaborn" packages, ' + 'or set "plot=False".') # Load plot settings try: load_plot_settings() except ImportError: raise ImportError('Cannot import modules for plotting. Either ' + 'install "matplotlib" and "seaborn" packages, ' + 'or set "plot=False".') # Extract variables from info dictionary num_inquiries = info['matrix']['num_inquiries'] error_atol = info['error']['error_atol'] error_rtol = info['error']['error_rtol'] * 100.0 confidence_level = info['error']['confidence_level'] num_samples_used = info['convergence']['num_samples_used'] min_num_samples = info['convergence']['min_num_samples'] max_num_samples = info['convergence']['max_num_samples'] converged = info['convergence']['converged'] samples = info['convergence']['samples'] samples_processed_order = info['convergence']['samples_processed_order'] # Convert scalars to arrays for easier indexing. When num_inquiries is 1, # all variables below are scalars. These are converted to arrays of size 1. if numpy.isscalar(num_samples_used): num_samples_used = numpy.array([num_samples_used]) if numpy.isscalar(converged): converged = numpy.array([converged]) if samples.ndim == 1: samples = numpy.array([samples]).T if numpy.isscalar(converged): converged = numpy.array([converged]) # Remove outliers from samples outlier_confidence_level = 0.001 cleaned_samples, outlier_indices = _remove_outliers( samples, samples_processed_order, num_samples_used, outlier_confidence_level) # Compute cumulative mean and errors (as sample indices progress) cumulative_mean, cumulative_abs_error, cumulative_rel_error = \ _compute_cumulative_statistics( cleaned_samples, samples_processed_order, num_samples_used, confidence_level) # Different plots depending on number of inquiries if num_inquiries == 1: # Plot both samples (on left axis) and relative error (on right axis) fig, ax = plt.subplots(ncols=2, figsize=(11, 5)) _plot_samples(ax[0], cleaned_samples, samples_processed_order, num_samples_used, confidence_level, cumulative_mean, cumulative_abs_error) _plot_error(ax[1], num_samples_used, min_num_samples, max_num_samples, error_atol, error_rtol, converged, cumulative_abs_error, cumulative_rel_error) else: # Plot only relative error (one axis) but for all inquiries fig, ax = plt.subplots(ncols=1, figsize=(8.3, 5)) _plot_error(ax, num_samples_used, min_num_samples, max_num_samples, error_atol, error_rtol, converged, cumulative_abs_error, cumulative_rel_error) plt.tight_layout() # Check if the graphical backend exists if matplotlib.get_backend() != 'agg': plt.show() else: # write the plot as SVG file in the current working directory save_plot(plt, 'Convergence', transparent_background=True)
kniz/wrd
mod/wrd/loader/pack/opaquePackLoading.cpp
#include "opaquePackLoading.hpp" namespace wrd { WRD_DEF_ME(opaquePackLoading) wbool me::verify(errReport& rpt, pack& pak) { return true; } }
frkasper/MacroUtils
macroutils/src/macroutils/templates/TemplateGeometry.java
<reponame>frkasper/MacroUtils<filename>macroutils/src/macroutils/templates/TemplateGeometry.java package macroutils.templates; import macroutils.MacroUtils; import macroutils.StaticDeclarations; import macroutils.UserDeclarations; import star.base.neo.DoubleVector; import star.cadmodeler.Body; import star.cadmodeler.CadModel; import star.cadmodeler.CanonicalSketchPlane; import star.cadmodeler.CircleSketchPrimitive; import star.cadmodeler.ExtrusionMerge; import star.cadmodeler.Face; import star.cadmodeler.LengthDimension; import star.cadmodeler.LineSketchPrimitive; import star.cadmodeler.PointSketchPrimitive; import star.cadmodeler.RadiusDimension; import star.cadmodeler.ScalarQuantityDesignParameter; import star.cadmodeler.Sketch; import star.cadmodeler.SolidModelManager; import star.cadmodeler.TransformSketchPlane; import star.common.Simulation; import star.common.Units; /** * Low-level class for some templated geometries with MacroUtils. * * @since April of 2016 * @author <NAME> */ public class TemplateGeometry { private macroutils.getter.MainGetter _get = null; private macroutils.io.MainIO _io = null; private MacroUtils _mu = null; private Simulation _sim = null; private UserDeclarations _ud = null; private static final String CAD_DIRECTIONS = "XYZ"; /** * Main constructor for this class. * * @param m given MacroUtils object. */ public TemplateGeometry(MacroUtils m) { _mu = m; _sim = m.getSimulation(); } /** * Creates a Block/Channel 3D-CAD model and creates a Part with 6 Part Surfaces inside, i.e., * x0, x1, y0, y1, z0 and z1. The default Tessellation option is used. See * {@link UserDeclarations#defTessOpt}. * * @param c1 given 3-components array with coordinates. E.g.: {0, -1, -10}. * @param c2 given 3-components array with coordinates. E.g.: {1, 1, 1}. * @param u given Units. * @param name given Cad Body name. * @param vo given verbose option. False will not print anything. * @return The Cad Body. */ public Body block(double[] c1, double[] c2, Units u, String name, boolean vo) { _io.say.action("Creating a Block 3D-CAD Model", vo); _io.say.value("Coordinate 1", _get.strings.fromArray(c1), u, vo); _io.say.value("Coordinate 2", _get.strings.fromArray(c2), u, vo); CadModel cm = _sim.get(SolidModelManager.class).createSolidModel(); cm.setPresentationName(name + " 3D-CAD Model"); CanonicalSketchPlane csp = ((CanonicalSketchPlane) cm.getFeatureManager().getObject("XY")); TransformSketchPlane newPlane = cm.getFeatureManager().createPlaneByTransformation(csp); newPlane.getTranslationVector().setComponents(0., 0., c1[2]); newPlane.getTranslationVector().setUnits(u); cm.getFeatureManager().execute(newPlane); Sketch sketch = cm.getFeatureManager().createSketch(newPlane); cm.getFeatureManager().startSketchEdit(sketch); double f = u.getConversion(); sketch.createRectangle(_get.objects.doubleVector(c1[0] * f, c1[1] * f), _get.objects.doubleVector(c2[0] * f, c2[1] * f)); _createDesignParameter(sketch, "Lx", "Line 2", c1[0] * f, c2[0] * f, u); _createDesignParameter(sketch, "Ly", "Line 1", c1[1] * f, c2[1] * f, u); cm.getFeatureManager().stopSketchEdit(sketch, true); cm.getFeatureManager().rollForwardToEnd(); Body body = _createExtrusion(cm, sketch, (c2[2] - c1[2]), u); body.setPresentationName(name); ((Face) body.getFaceManager().getObject("Face 1")).setNameAttribute("x0"); ((Face) body.getFaceManager().getObject("Face 3")).setNameAttribute("x1"); ((Face) body.getFaceManager().getObject("Face 4")).setNameAttribute("y0"); ((Face) body.getFaceManager().getObject("Face 2")).setNameAttribute("y1"); ((Face) body.getFaceManager().getObject("Face 6")).setNameAttribute("z0"); ((Face) body.getFaceManager().getObject("Face 5")).setNameAttribute("z1"); _sim.get(SolidModelManager.class).endEditCadModel(cm); _io.say.msg("Creating a Part...", vo); cm.createParts(_get.objects.arrayList(body), "SharpEdges", 30.0, _ud.defTessOpt.getValue(), false, 1.0E-5); _io.say.ok(vo); return body; } /** * Creates a Cylinder using the 3D-CAD model and creates a Part using the default Tessellation * option. See {@link UserDeclarations#defTessOpt}. * * @param r given Radius. * @param l given Length. * @param org given origin as a 3-components array with coordinates. E.g.: {0, -1, -10}. * @param u given Units. * @param ax given extrusion direction. See {@link macroutils.StaticDeclarations.Axis} for * options. * @param name given Cylinder name. * @param vo given verbose option. False will not print anything. * @return The Cad Body. */ public Body cylinder(double r, double l, double[] org, Units u, StaticDeclarations.Axis ax, String name, boolean vo) { _io.say.action("Creating a Cylinder 3D-CAD Model", vo); _io.say.value("Radius", r, u, vo); _io.say.value(ax.toString() + " Length", l, u, vo); double rC = r * u.getConversion(); double[] offsetPlane = { 0., 0., 0. }; double[] sketchCircle = { 0., 0. }; CadModel cm = _sim.get(SolidModelManager.class).createSolidModel(); cm.setPresentationName(name + " 3D-CAD Model"); String pln = CAD_DIRECTIONS.replace(ax.toString(), ""); switch (ax) { case X: offsetPlane[2] = org[0]; sketchCircle[0] = org[1] * u.getConversion(); sketchCircle[1] = org[2] * u.getConversion(); break; case Y: offsetPlane[2] = org[1]; sketchCircle[0] = org[2] * u.getConversion(); sketchCircle[1] = org[0] * u.getConversion(); pln = "ZX"; break; case Z: offsetPlane[2] = org[2]; sketchCircle[0] = org[0] * u.getConversion(); sketchCircle[1] = org[1] * u.getConversion(); break; } CanonicalSketchPlane csp = ((CanonicalSketchPlane) cm.getFeatureManager().getObject(pln)); TransformSketchPlane newPlane = cm.getFeatureManager().createPlaneByTransformation(csp); newPlane.getTranslationVector().setComponents(offsetPlane[0], offsetPlane[1], offsetPlane[2]); newPlane.getTranslationVector().setUnits(u); cm.getFeatureManager().execute(newPlane); Sketch sketch = cm.getFeatureManager().createSketch(newPlane); cm.getFeatureManager().startSketchEdit(sketch); CircleSketchPrimitive circle = sketch.createCircle(new DoubleVector(sketchCircle), rC); PointSketchPrimitive pt = (PointSketchPrimitive) sketch.getSketchPrimitiveManager().getObject("Point 1"); sketch.createFixationConstraint(pt); RadiusDimension rd = sketch.createRadiusDimension(circle, rC, u); rd.getRadius().createDesignParameter("Radius"); cm.getFeatureManager().stopSketchEdit(sketch, true); cm.getFeatureManager().rollForwardToEnd(); Body body = _createExtrusion(cm, sketch, l, u); body.setPresentationName(name); Face f0 = ((Face) body.getFaceManager().getObject("Face 3")); f0.setNameAttribute(ax.toString().toLowerCase() + "0"); Face f1 = ((Face) body.getFaceManager().getObject("Face 2")); f1.setNameAttribute(ax.toString().toLowerCase() + "1"); _sim.get(SolidModelManager.class).endEditCadModel(cm); _io.say.msg(vo, "Creating Part: %s...", cm.getPresentationName()); cm.createParts(_get.objects.arrayList(body), "SharpEdges", 30.0, _ud.defTessOpt.getValue(), false, 1.0E-5); _io.say.ok(vo); return body; } /** * This method is called automatically by {@link MacroUtils}. */ public void updateInstances() { _get = _mu.get; _io = _mu.io; _ud = _mu.userDeclarations; } private void _createDesignParameter(Sketch sketch, String dpName, String lineName, double x0, double x1, Units u) { LineSketchPrimitive lsp = (LineSketchPrimitive) sketch.getSketchPrimitive(lineName); LengthDimension ld = sketch.createLengthDimension(lsp, x1 - x0, u); ScalarQuantityDesignParameter sqd = ld.getLength().createDesignParameter(dpName); } private Body _createExtrusion(CadModel cm, Sketch sketch, double l, Units u) { ExtrusionMerge em = cm.getFeatureManager().createExtrusionMerge(sketch); ScalarQuantityDesignParameter emv = em.getDistance().createDesignParameter("Lz"); em.setDirectionOption(0); em.setExtrudedBodyTypeOption(0); emv.getQuantity().setUnits(u); emv.getQuantity().setValue(l); em.setDistanceOption(0); em.setCoordinateSystemOption(0); em.setDraftOption(0); em.setCoordinateSystemOption(0); em.setFace(null); em.setBody(null); em.setSketch(sketch); em.setPostOption(1); em.setExtrusionOption(0); cm.getFeatureManager().execute(em); return cm.getBodyManager().getBodies().iterator().next(); } }
oliverselinger/failsafe-executor
src/main/java/os/failsafe/executor/Execution.java
<reponame>oliverselinger/failsafe-executor package os.failsafe.executor; import os.failsafe.executor.utils.Database; import os.failsafe.executor.utils.SystemClock; import java.time.LocalDateTime; import java.util.List; import java.util.Optional; class Execution { private final Database database; private final Task task; private final FailsafeExecutor.TaskRegistration taskRegistration; private final List<TaskExecutionListener> listeners; private final SystemClock systemClock; private final TaskRepository taskRepository; Execution(Database database, Task task, FailsafeExecutor.TaskRegistration taskRegistration, List<TaskExecutionListener> listeners, SystemClock systemClock, TaskRepository taskRepository) { this.database = database; this.task = task; this.taskRegistration = taskRegistration; this.listeners = listeners; this.systemClock = systemClock; this.taskRepository = taskRepository; } public String perform() { try { if (taskRegistration.requiresTransaction()) { database.transactionNoResult(connection -> { taskRegistration.transactionalFunction.accept(connection, task.getParameter()); taskRepository.delete(connection, task); }); } if (taskRegistration.isRegularTask()) { taskRegistration.function.accept(task.getParameter()); taskRepository.delete(task); } if (taskRegistration.isScheduled()) { taskRegistration.function.accept(task.getParameter()); Optional<LocalDateTime> nextExecutionTime = taskRegistration.schedule.nextExecutionTime(systemClock.now()); if (nextExecutionTime.isPresent()) { taskRepository.unlock(task, nextExecutionTime.get()); } else { taskRepository.delete(task); } } notifySuccess(); } catch (Exception exception) { taskRepository.saveFailure(task, new ExecutionFailure(systemClock.now(), exception)); notifyFailed(exception); } return task.getId(); } private void notifySuccess() { listeners.forEach(l -> l.succeeded(task.getName(), task.getId(), task.getParameter())); } private void notifyFailed(Exception exception) { listeners.forEach(l -> l.failed(task.getName(), task.getId(), task.getParameter(), exception)); } }
Const-me/vis_avs_dx
avs/vis_avs/r_colorreduction.cpp
/* LICENSE ------- Copyright 2005 Nullsoft, Inc. All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. * Neither the name of Nullsoft nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #include "stdafx.h" #include "resource.h" #include "r_defs.h" #ifndef LASER // this will be the directory and APE name displayed in the AVS Editor #define MOD_NAME "Trans / Color Reduction" #define C_THISCLASS C_ColorReduction typedef struct { char fname[ MAX_PATH ]; int levels; } apeconfig; class C_THISCLASS : public C_RBASE { protected: public: C_THISCLASS(); virtual ~C_THISCLASS(); virtual HWND conf( HINSTANCE hInstance, HWND hwndParent ); virtual char *get_desc(); virtual void load_config( unsigned char *data, int len ); virtual int save_config( unsigned char *data ); apeconfig config; HWND hwndDlg; }; // global configuration dialog pointer static C_THISCLASS *g_ConfigThis; static HINSTANCE g_hDllInstance; // this is where we deal with the configuration screen static BOOL CALLBACK g_DlgProc( HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam ) { switch( uMsg ) { case WM_HSCROLL: { if( LOWORD( wParam ) == TB_ENDTRACK ) g_ConfigThis->config.levels = SendMessage( GetDlgItem( hwndDlg, IDC_LEVELS ), TBM_GETPOS, 0, 0 ); { char buf[ 4 ]; int a, b; a = 8 - g_ConfigThis->config.levels; b = 0x100; while( a-- ) b >>= 1; wsprintf( buf, "%d", b ); SetDlgItemText( hwndDlg, IDC_LEVELTEXT, buf ); } } return 1; case WM_INITDIALOG: g_ConfigThis->hwndDlg = hwndDlg; SendMessage( GetDlgItem( hwndDlg, IDC_LEVELS ), TBM_SETRANGE, TRUE, MAKELONG( 1, 8 ) ); SendMessage( GetDlgItem( hwndDlg, IDC_LEVELS ), TBM_SETPOS, TRUE, g_ConfigThis->config.levels ); SetFocus( GetDlgItem( hwndDlg, IDC_LEVELS ) ); { char buf[ 4 ]; int a, b; a = 8 - g_ConfigThis->config.levels; b = 0x100; while( a-- ) b >>= 1; wsprintf( buf, "%d", b ); SetDlgItemText( hwndDlg, IDC_LEVELTEXT, buf ); } return 1; case WM_DESTROY: KillTimer( hwndDlg, 1 ); return 1; } return 0; } // set up default configuration C_THISCLASS::C_THISCLASS() { memset( &config, 0, sizeof( apeconfig ) ); config.levels = 7; CREATE_DX_EFFECT( config.levels ); } // virtual destructor C_THISCLASS::~C_THISCLASS() { } HWND C_THISCLASS::conf( HINSTANCE hInstance, HWND hwndParent ) { g_ConfigThis = this; return CreateDialog( hInstance, MAKEINTRESOURCE( IDD_CFG_COLORREDUCTION ), hwndParent, (DLGPROC)g_DlgProc ); } char *C_THISCLASS::get_desc( void ) { return MOD_NAME; } void C_THISCLASS::load_config( unsigned char *data, int len ) { if( len == sizeof( apeconfig ) ) memcpy( &this->config, data, len ); else memset( &this->config, 0, sizeof( apeconfig ) ); } int C_THISCLASS::save_config( unsigned char *data ) { memcpy( data, &this->config, sizeof( apeconfig ) ); return sizeof( apeconfig ); } C_RBASE *R_ColorReduction( char *desc ) { if( desc ) { strcpy( desc, MOD_NAME ); return NULL; } return ( C_RBASE * ) new C_THISCLASS(); } #endif
yusenD/MySubway
app/src/main/java/com/dsunny/util/AppUtil.java
<reponame>yusenD/MySubway package com.dsunny.util; import android.app.Activity; import android.content.ClipData; import android.content.ClipboardManager; import android.content.Context; import android.content.pm.PackageInfo; import android.content.pm.PackageManager; import android.content.res.Resources; import android.net.ConnectivityManager; import android.net.NetworkInfo; import android.text.TextUtils; import android.view.View; import android.view.inputmethod.InputMethodManager; import com.dsunny.activity.bean.TransferDetail; import com.dsunny.activity.bean.TransferRoute; import com.dsunny.common.AppConstants; import com.dsunny.common.SubwayData; import com.infrastructure.util.BaseUtil; import java.io.FileOutputStream; import java.io.InputStream; import java.util.ArrayList; import java.util.Collections; import java.util.Comparator; import java.util.List; /** * 本地工具类 */ public class AppUtil extends BaseUtil { /** * dp转px * * @param dpValue dp值 * @return px值 */ public static int dp2px(final float dpValue) { final float density = Resources.getSystem().getDisplayMetrics().density; return (int) (dpValue * density + 0.5f); } /** * px转dp * * @param pxValue px值 * @return dp值 */ public static int px2dip(final float pxValue) { final float density = Resources.getSystem().getDisplayMetrics().density; return (int) (pxValue / density + 0.5f); } /** * 关闭输入法 * * @param activity 当前Activity */ public static void closeInputMethod(final Activity activity) { final View view = activity.getCurrentFocus(); if (view != null) { closeInputMethod(activity, view); } } /** * 关闭输入法 * * @param activity 当前Activity * @param view 打开输入法的View */ public static void closeInputMethod(final Activity activity, final View view) { final InputMethodManager imm = (InputMethodManager) activity.getSystemService(Context.INPUT_METHOD_SERVICE); imm.hideSoftInputFromWindow(view.getWindowToken(), 0); } /** * @param context 当前Activity * @return 是否使用WiFi联网 */ public static boolean isWifiConnected(final Context context) { final ConnectivityManager cm = (ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE); final NetworkInfo networkInfo = cm.getActiveNetworkInfo(); return networkInfo != null && networkInfo.isConnected() && networkInfo.getTypeName().equalsIgnoreCase("WIFI"); } /** * 获取当前App版本号 * * @param context 当前Activity或Application * @return App版本号 */ public static int getVersionCode(Context context) { try { final PackageInfo packInfo = context.getPackageManager().getPackageInfo(context.getPackageName(), 0); return packInfo.versionCode; } catch (PackageManager.NameNotFoundException e) { e.printStackTrace(); } return 1; } /** * 拷贝数据库文件 * * @param context Application Context */ public static void copyDBFile(final Context context) { InputStream is = null; FileOutputStream fos = null; try { is = context.getResources().getAssets().open(AppConstants.SUBWAY_DB_NAME); fos = new FileOutputStream(AppConstants.SUBWAY_DB_FILE_PATH); byte[] buffer = new byte[1024]; int count; while ((count = is.read(buffer)) > 0) { fos.write(buffer, 0, count); } fos.close(); is.close(); } catch (Exception e) { e.printStackTrace(); } finally { closeStream(is); closeStream(fos); } } /** * 将数组转换为String形式表示(For log) * * @param array 数组 * @return 数组的String形式 */ public static <T> String ArrayAsString(final T[] array) { StringBuilder sb = new StringBuilder(); sb.append("[").append(TextUtils.join(",", array)).append("]"); return sb.toString(); } /** * 将List<T[]>转换为String形式表示(For log) * * @param lstStringArray 数组List * @return List<T[]>的String形式 */ public static <T> String ListArrayAsString(final List<T[]> lstStringArray) { StringBuilder sb = new StringBuilder(); sb.append("{"); for (T[] sArr : lstStringArray) { sb.append("[").append(TextUtils.join(",", sArr)).append("]"); } sb.append("}"); return sb.toString(); } public static class SortSubwayMap { private int type; public SortSubwayMap(int type) { this.type = 0; } public List<TransferRoute> sortRouteList(List<TransferRoute> list) { List<TransferRoute> newTransferRoute = new ArrayList<>(); TransferRoute minData = list.get(0); switch (type){ case SubwayData.TRANSFER_SORT: while(!list.isEmpty()){ int i; for (i = 0; i < list.size(); i++) { if (list.get(i).lstTransferSubRoute.size() < minData.lstTransferSubRoute.size()) { minData = list.get(i); } } newTransferRoute.add(minData); list.remove(i); } break; case SubwayData.TOTAL_SORT: while(!list.isEmpty()){ int i; for (i = 0;i<list.size();i++) { if ((list.get(i).elapsedTime + list.get(i).lstTransferSubRoute.size() * 5) < (minData.elapsedTime + list.get(i).lstTransferSubRoute.size() * 5)) { minData = list.get(i); } } newTransferRoute.add(minData); list.remove(i); } break; case SubwayData.TIME_SORT: int i; while(!list.isEmpty()){ for (i = 0;i<list.size();i++) { if (list.get(i).elapsedTime < minData.elapsedTime) { minData = list.get(i); } } newTransferRoute.add(minData); list.remove(i); } break; default: break; } return newTransferRoute; } } public static class SubwayMapComp implements Comparator<TransferRoute> { private int type; public SubwayMapComp(int type) { this.type = type; } @Override public int compare(TransferRoute lhs, TransferRoute rhs) { switch (type){ case SubwayData.TRANSFER_SORT: return lhs.lstTransferSubRoute.size() - rhs.lstTransferSubRoute.size(); case SubwayData.TOTAL_SORT: return (lhs.elapsedTime + lhs.lstTransferSubRoute.size() * 5) - (rhs.elapsedTime + rhs.lstTransferSubRoute.size() * 5); case SubwayData.TIME_SORT: return lhs.elapsedTime - rhs.elapsedTime; default: return 0; } } } }
samuelhehe/AppMarket
src/com/samuel/downloader/app/AtyAppMgr.java
<reponame>samuelhehe/AppMarket package com.samuel.downloader.app; import java.util.ArrayList; import java.util.List; import net.tsz.afinal.FinalDBChen; import android.content.Context; import android.os.Bundle; import android.os.Handler; import android.view.LayoutInflater; import android.view.View; import android.view.View.OnClickListener; import android.view.ViewGroup; import android.widget.AdapterView; import android.widget.AdapterView.OnItemClickListener; import android.widget.BaseAdapter; import android.widget.ImageView; import android.widget.ListView; import android.widget.TextView; import com.samuel.downloader.adapter.MainItemAdapter; import com.samuel.downloader.bean.AppInfo; import com.samuel.downloader.bean.DownloadFileItem; import com.samuel.downloader.bean.InstalledAppInfo; import com.samuel.downloader.dao.PakageInfoService; import com.samuel.downloader.utils.ApplicationDetailInfo; import com.samuel.downloader.utils.ToastUtils; public class AtyAppMgr extends BaseActivity implements OnClickListener { protected static final int LOAD_COMPLETE = 1; protected static final int LOAD_FAIL = 0; protected static final String TAG = "AppMgrActivity"; protected TextView current_content_title_back , current_content_title; protected TextView appItem_title = null; protected ListView installedApp_lv = null; protected View loadingView = null; protected List<InstalledAppInfo> datas = null; protected ArrayList<AppInfo> needupdateapps = null; private FinalDBChen db; protected static Context context; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); this.setContentView(R.layout.app_mgr); context = AtyAppMgr.this; // 创建一个数据库 new FinalDBChen(this, DBNAME, new DownloadFileItem(), TABNAME_DOWNLOADTASK, null); db = new FinalDBChen(this, this.getDatabasePath(DBNAME).getAbsolutePath()); selectInitView(savedInstanceState); } protected void selectInitView(Bundle savedInstanceState) { /** * current_content_title back * * app_mgr_info_layout visible * * app_mgr_item_title tv * * app_mgr_upgrade_info_listview lv * * app_mgr_all_new_layout * */ current_content_title_back = (TextView) this.findViewById(R.id.current_content_title_back); current_content_title_back.setOnClickListener(this); current_content_title = (TextView) this.findViewById(R.id.current_content_title); appItem_title = (TextView) this.findViewById(R.id.app_mgr_item_title); loadingView = this.findViewById(R.id.app_mgr_loading_layout); // / 应用列表 View layoutView = this.findViewById(R.id.app_mgr_info_layout); // / 全部最新 View allNewView = this.findViewById(R.id.app_mgr_all_new_layout); switch (this.getIntent().getFlags()) { case R.id.app_mgr_perview_update: current_content_title.setText(R.string.sys_common_app_update); appItem_title.setText(R.string.app_mgr_info_hint); needupdateapps = (ArrayList<AppInfo>) this.getIntent().getSerializableExtra(AppInfo.TAG.TAG_UPDATES); if (needupdateapps != null) { if (needupdateapps.size() >= 1) { layoutView.setVisibility(View.VISIBLE); allNewView.setVisibility(View.GONE); // // 可升级列表 installedApp_lv = (ListView) layoutView .findViewById(R.id.app_mgr_upgrade_info_listview); installedApp_lv.setAdapter(new MainItemAdapter(needupdateapps, R.layout.simple_item,AtyAppMgr.this,db)); } } else { layoutView.setVisibility(View.GONE); allNewView.setVisibility(View.VISIBLE); } // 应用更新 break; case R.id.app_mgr_perview_appmgr: current_content_title.setText(R.string.sys_common_app_mgr); appItem_title.setText(R.string.app_mgr_installed_info_hint); installedApp_lv = (ListView) layoutView .findViewById(R.id.app_mgr_upgrade_info_listview); loadingView.setVisibility(View.GONE); installedApp_lv.setOnItemClickListener(new InstalledItemListener()); loadData(); // 应用管理 break; } } private final class InstalledItemListener implements OnItemClickListener { @Override public void onItemClick(AdapterView<?> parent, View view, int position, long id) { if (datas != null) { String packageName = datas.get(position).getPackageName(); ApplicationDetailInfo appDetailInfo = new ApplicationDetailInfo( context); appDetailInfo.showInstalledAppDetails(packageName); } } } protected Handler handler = new Handler() { public void handleMessage(android.os.Message msg) { switch (msg.what) { case LOAD_COMPLETE: datas = (List<InstalledAppInfo>) msg.obj; installedApp_lv.setAdapter(new AppMgrAdapter(datas, R.layout.app_themes_smaller_downloader_item, AtyAppMgr.this)); loadingView.setVisibility(View.GONE); break; case LOAD_FAIL: ToastUtils.show(AtyAppMgr.this, "获取应用列表失败,请稍候重试"); break; } }; }; /** * * load data the listView required */ private void loadData() { new Thread(new Runnable() { @Override public void run() { try { List<InstalledAppInfo> datas = PakageInfoService .getAppInfos(getApplicationContext()); // String inputParams = // JsonUtils.getInstalledAppInputParamsJsonStr(PakageInfoService.getInstalledAppInputParams(getApplicationContext())); // Log.i(TAG, inputParams); if (datas != null && datas.size() > 0) { handler.sendMessage(handler.obtainMessage( LOAD_COMPLETE, datas)); // for (Iterator<InstalledAppInfo> iterator = datas.iterator(); iterator // .hasNext();) { // InstalledAppInfo installedAppInfo = iterator.next(); // System.out.println(installedAppInfo.getPackageName()); // // } } else { handler.sendMessage(handler.obtainMessage(LOAD_FAIL)); } } catch (Exception e) { e.printStackTrace(); } } }).start(); } private final class AppMgrAdapter extends BaseAdapter { protected List<InstalledAppInfo> datas; protected LayoutInflater inflater; protected int itemres; public AppMgrAdapter(List<InstalledAppInfo> datas, int itemres, Context context) { this.datas = datas; this.itemres = itemres; inflater = (LayoutInflater) context .getSystemService(Context.LAYOUT_INFLATER_SERVICE); } @Override public int getCount() { return datas.size(); } @Override public Object getItem(int position) { return datas.get(position); } @Override public long getItemId(int position) { return position; } @Override public View getView(int position, View convertView, ViewGroup parent) { ImageView appIcon = null; TextView appName = null; TextView versionName = null; TextView button_tv = null; TextView launchapp = null; final InstalledAppInfo contentInfo = datas.get(position); /** * lefticon img toptxt tv name bottomtxt tv neirong btn1 tv detail */ if (convertView == null) { convertView = inflater.inflate(itemres, null); appIcon = (ImageView) convertView.findViewById(R.id.lefticon); appName = (TextView) convertView.findViewById(R.id.toptxt); versionName = (TextView) convertView.findViewById(R.id.bottomtxt); button_tv = (TextView) convertView.findViewById(R.id.btn1); // button_tv.setOnClickListener(new OnClickListener() { // // @Override // public void onClick(View v) { // ApplicationDetailInfo appDetailInfo = new ApplicationDetailInfo( // context); // appDetailInfo.showInstalledAppDetails(contentInfo // .getPackageName()); // } // }); launchapp = (TextView) convertView.findViewById(R.id.launchapp); launchapp.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { ApplicationDetailInfo appDetailInfo = new ApplicationDetailInfo( context); appDetailInfo.launchApp(contentInfo.getPackageName()); } }); convertView.setTag(new DataWrapper(appIcon, appName, versionName, button_tv, launchapp)); } else { DataWrapper dataWrapper = (DataWrapper) convertView.getTag(); appIcon = dataWrapper.appIcon; appName = dataWrapper.appName; versionName = dataWrapper.versionName; button_tv = dataWrapper.button_tv; launchapp = dataWrapper.launchapp; } appName.setText(contentInfo.getAppName()); versionName.setText(contentInfo.getVersionName()); appIcon.setImageDrawable(contentInfo.getDrawable()); button_tv.setText("详情"); launchapp.setText("启动"); launchapp.setVisibility(View.GONE); return convertView; } private class DataWrapper { ImageView appIcon = null; TextView appName = null; TextView versionName = null; TextView button_tv = null; TextView launchapp = null; public DataWrapper(ImageView appIcon, TextView appName, TextView versionName, TextView button_tv, TextView launchapp) { super(); this.appIcon = appIcon; this.appName = appName; this.versionName = versionName; this.button_tv = button_tv; this.launchapp = launchapp; } } } @Override public void onClick(View v) { this.finish(); } }
bayashiok/httpd
include/ap_expr.h
/* 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. */ /** * @file ap_expr.h * @brief Expression parser * * @defgroup AP_EXPR Expression parser * @ingroup APACHE_CORE * @{ */ #ifndef AP_EXPR_H #define AP_EXPR_H #include "httpd.h" #include "http_config.h" #include "ap_regex.h" #ifdef __cplusplus extern "C" { #endif /** A node in the expression parse tree */ typedef struct ap_expr_node ap_expr_t; /** Struct describing a parsed expression */ typedef struct { /** The root of the actual expression parse tree */ ap_expr_t *root_node; /** The filename where the expression has been defined (for logging). * May be NULL */ const char *filename; /** The line number where the expression has been defined (for logging). */ unsigned int line_number; /** Flags relevant for the expression, see AP_EXPR_FLAG_* */ unsigned int flags; /** The module that is used for loglevel configuration */ int module_index; } ap_expr_info_t; /** Use ssl_expr compatibility mode (changes the meaning of the comparison * operators) */ #define AP_EXPR_FLAG_SSL_EXPR_COMPAT 1 /** Don't add siginificant request headers to the Vary response header */ #define AP_EXPR_FLAG_DONT_VARY 2 /** Don't allow functions/vars that bypass the current request's access * restrictions or would otherwise leak confidential information. * Used by e.g. mod_include. */ #define AP_EXPR_FLAG_RESTRICTED 4 /** Expression evaluates to a string, not to a bool */ #define AP_EXPR_FLAG_STRING_RESULT 8 /** * Evaluate a parse tree, simple interface * @param r The current request * @param expr The expression to be evaluated * @param err Where an error message should be stored * @return > 0 if expression evaluates to true, == 0 if false, < 0 on error * @note err will be set to NULL on success, or to an error message on error * @note request headers used during evaluation will be added to the Vary: * response header, unless ::AP_EXPR_FLAG_DONT_VARY is set. */ AP_DECLARE(int) ap_expr_exec(request_rec *r, const ap_expr_info_t *expr, const char **err); /** * Evaluate a parse tree, with access to regexp backreference * @param r The current request * @param expr The expression to be evaluated * @param nmatch size of the regex match vector pmatch * @param pmatch information about regex matches * @param source the string that pmatch applies to * @param err Where an error message should be stored * @return > 0 if expression evaluates to true, == 0 if false, < 0 on error * @note err will be set to NULL on success, or to an error message on error * @note nmatch/pmatch/source can be used both to make previous matches * available to ap_expr_exec_re and to use ap_expr_exec_re's matches * later on. * @note request headers used during evaluation will be added to the Vary: * response header, unless ::AP_EXPR_FLAG_DONT_VARY is set. */ AP_DECLARE(int) ap_expr_exec_re(request_rec *r, const ap_expr_info_t *expr, apr_size_t nmatch, ap_regmatch_t *pmatch, const char **source, const char **err); /** Context used during evaluation of a parse tree, created by ap_expr_exec */ typedef struct { /** the current request */ request_rec *r; /** the current connection */ conn_rec *c; /** the current virtual host */ server_rec *s; /** the pool to use */ apr_pool_t *p; /** where to store the error string */ const char **err; /** ap_expr_info_t for the expression */ const ap_expr_info_t *info; /** regex match information for back references */ ap_regmatch_t *re_pmatch; /** size of the vector pointed to by re_pmatch */ apr_size_t re_nmatch; /** the string corresponding to the re_pmatch */ const char **re_source; /** A string where the comma separated names of headers are stored * to be later added to the Vary: header. If NULL, the caller is not * interested in this information. */ const char **vary_this; /** where to store the result string */ const char **result_string; /** Arbitrary context data provided by the caller for custom functions */ void *data; /** The current recursion level */ int reclvl; } ap_expr_eval_ctx_t; /** * Evaluate a parse tree, full featured version * @param ctx The evaluation context with all data filled in * @return > 0 if expression evaluates to true, == 0 if false, < 0 on error * @note *ctx->err will be set to NULL on success, or to an error message on * error * @note request headers used during evaluation will be added to the Vary: * response header if ctx->vary_this is set. */ AP_DECLARE(int) ap_expr_exec_ctx(ap_expr_eval_ctx_t *ctx); /** * Evaluate a parse tree of a string valued expression * @param r The current request * @param expr The expression to be evaluated * @param err Where an error message should be stored * @return The result string, NULL on error * @note err will be set to NULL on success, or to an error message on error * @note request headers used during evaluation will be added to the Vary: * response header, unless ::AP_EXPR_FLAG_DONT_VARY is set. */ AP_DECLARE(const char *) ap_expr_str_exec(request_rec *r, const ap_expr_info_t *expr, const char **err); /** * Evaluate a parse tree of a string valued expression * @param r The current request * @param expr The expression to be evaluated * @param nmatch size of the regex match vector pmatch * @param pmatch information about regex matches * @param source the string that pmatch applies to * @param err Where an error message should be stored * @return The result string, NULL on error * @note err will be set to NULL on success, or to an error message on error * @note nmatch/pmatch/source can be used both to make previous matches * available to ap_expr_exec_re and to use ap_expr_exec_re's matches * later on. * @note request headers used during evaluation will be added to the Vary: * response header, unless ::AP_EXPR_FLAG_DONT_VARY is set. */ AP_DECLARE(const char *) ap_expr_str_exec_re(request_rec *r, const ap_expr_info_t *expr, apr_size_t nmatch, ap_regmatch_t *pmatch, const char **source, const char **err); /** * The parser can be extended with variable lookup, functions, and * and operators. * * During parsing, the parser calls the lookup function to resolve a * name into a function pointer and an opaque context for the function. * If the argument to a function or operator is constant, the lookup function * may also parse that argument and store the parsed data in the context. * * The default lookup function is the hook ::ap_expr_lookup_default which just * calls ap_run_expr_lookup. Modules can use it to make functions and * variables generally available. * * An ap_expr consumer can also provide its own custom lookup function to * modify the set of variables and functions that are available. The custom * lookup function can in turn call 'ap_run_expr_lookup'. */ /** Unary operator, takes one string argument and returns a bool value. * The name must have the form '-z' (one letter only). * @param ctx The evaluation context * @param data An opaque context provided by the lookup hook function * @param arg The (right) operand * @return 0 or 1 */ typedef int ap_expr_op_unary_t(ap_expr_eval_ctx_t *ctx, const void *data, const char *arg); /** Binary operator, takes two string arguments and returns a bool value. * The name must have the form '-cmp' (at least two letters). * @param ctx The evaluation context * @param data An opaque context provided by the lookup hook function * @param arg1 The left operand * @param arg2 The right operand * @return 0 or 1 */ typedef int ap_expr_op_binary_t(ap_expr_eval_ctx_t *ctx, const void *data, const char *arg1, const char *arg2); /** String valued function, takes a string argument and returns a string * @param ctx The evaluation context * @param data An opaque context provided by the lookup hook function * @param arg The argument * @return The functions result string, may be NULL for 'empty string' */ typedef const char *(ap_expr_string_func_t)(ap_expr_eval_ctx_t *ctx, const void *data, const char *arg); /** String valued function, takes a list argument and returns a string * @param ctx The evaluation context * @param data An opaque context provided by the lookup hook function * @param args The list of string arguments * @return The functions result string, may be NULL for 'empty string' */ typedef const char *(ap_expr_string_list_func_t)(ap_expr_eval_ctx_t *ctx, const void *data, const apr_array_header_t *args); /** List valued function, takes a string argument and returns a list of strings * Can currently only be called following the builtin '-in' operator. * @param ctx The evaluation context * @param data An opaque context provided by the lookup hook function * @param arg The argument * @return The functions result list of strings, may be NULL for 'empty array' */ typedef apr_array_header_t *(ap_expr_list_func_t)(ap_expr_eval_ctx_t *ctx, const void *data, const char *arg); /** Variable lookup function, takes no argument and returns a string * @param ctx The evaluation context * @param data An opaque context provided by the lookup hook function * @return The expanded variable */ typedef const char *(ap_expr_var_func_t)(ap_expr_eval_ctx_t *ctx, const void *data); /** parameter struct passed to the lookup hook functions */ typedef struct { /** type of the looked up object */ int type; #define AP_EXPR_FUNC_VAR 0 #define AP_EXPR_FUNC_STRING 1 #define AP_EXPR_FUNC_LIST 2 #define AP_EXPR_FUNC_OP_UNARY 3 #define AP_EXPR_FUNC_OP_BINARY 4 /** name of the looked up object */ const char *name; int flags; apr_pool_t *pool; apr_pool_t *ptemp; /** where to store the function pointer */ const void **func; /** where to store the function's context */ const void **data; /** where to store the error message (if any) */ const char **err; /** arg for pre-parsing (only if a simple string). * For binary ops, this is the right argument. * For functions with more arguments, this is the first string * argument. */ const char *arg; } ap_expr_lookup_parms; /** Function for looking up the provider function for a variable, operator * or function in an expression. * @param parms The parameter struct, also determins where the result is * stored. * @return OK on success, * !OK on failure, * DECLINED if the requested name is not handled by this function */ typedef int (ap_expr_lookup_fn_t)(ap_expr_lookup_parms *parms); /** Default lookup function which just calls ap_run_expr_lookup(). * ap_run_expr_lookup cannot be used directly because it has the wrong * calling convention under Windows. */ AP_DECLARE_NONSTD(int) ap_expr_lookup_default(ap_expr_lookup_parms *parms); AP_DECLARE_HOOK(int, expr_lookup, (ap_expr_lookup_parms *parms)) /** * Parse an expression into a parse tree * @param pool Pool * @param ptemp temp pool * @param info The ap_expr_info_t struct (with values filled in) * @param expr The expression string to parse * @param lookup_fn The lookup function to use, NULL for default * @return NULL on success, error message on error. * A pointer to the resulting parse tree will be stored in * info->root_node. */ AP_DECLARE(const char *) ap_expr_parse(apr_pool_t *pool, apr_pool_t *ptemp, ap_expr_info_t *info, const char *expr, ap_expr_lookup_fn_t *lookup_fn); /** * High level interface to ap_expr_parse that also creates ap_expr_info_t and * uses info from cmd_parms to fill in most of it. * @param cmd The cmd_parms struct * @param expr The expression string to parse * @param flags The flags to use, see AP_EXPR_FLAG_* * @param err Set to NULL on success, error message on error * @param lookup_fn The lookup function used to lookup vars, functions, and * operators * @param module_index The module_index to set for the expression * @return The parsed expression * @note Usually ap_expr_parse_cmd() should be used */ AP_DECLARE(ap_expr_info_t *) ap_expr_parse_cmd_mi(const cmd_parms *cmd, const char *expr, unsigned int flags, const char **err, ap_expr_lookup_fn_t *lookup_fn, int module_index); /** * Convenience wrapper for ap_expr_parse_cmd_mi() that sets * module_index = APLOG_MODULE_INDEX */ #define ap_expr_parse_cmd(cmd, expr, flags, err, lookup_fn) \ ap_expr_parse_cmd_mi(cmd, expr, flags, err, lookup_fn, APLOG_MODULE_INDEX) /** * Internal initialisation of ap_expr (for httpd internal use) */ void ap_expr_init(apr_pool_t *pool); #ifdef __cplusplus } #endif #endif /* AP_EXPR_H */ /** @} */
qsjdhm/vue2-cli-test
src/subtree/packages/v-tree/setMethods.js
const METHOD_NAMES = [ 'filter', 'updateKeyChildren', 'getCheckedNodes', 'setCheckedNodes', 'getCheckedKeys', 'setCheckedKeys', 'setChecked', 'getHalfCheckedNodes', 'getHalfCheckedKeys', 'getCurrentKey', 'getCurrentNode', 'setCurrentKey', 'setCurrentNode', 'getNode', 'remove', 'append', 'insertBefore', 'insertAfter' ]; const methods = {}; METHOD_NAMES.forEach((name) => { methods[name] = function (...args) { const { ElTreeRef } = this.$refs; if (ElTreeRef && ElTreeRef[name]) { let result = ElTreeRef[name](...args); if (result) { return result; } } }; }); export default methods;
yodakingdoms/kingdoms
Areas/Bird/Oakdale/o/Village/Monster/villager_man.c
// Inherited by male villagers #pragma strict_types #include "../def.h" inherit MONSTER + "villager_adult"; void create_object(void); void create_object(void) { ::create_object(); add_id("man"); set_gender(1); load_a_chat(25,({ "The man shouts: Foul servant of Nirach!\n" })); }
purushothamgowthu/deeppy
deeppy/feedforward/neural_network.py
import numpy as np from ..base import Model, ParamMixin, CollectionMixin from ..feed import Feed from ..loss import SoftmaxCrossEntropy class NeuralNetwork(Model, CollectionMixin): def __init__(self, layers, loss): self.layers = layers self.loss = loss self.bprop_until = next((idx for idx, l in enumerate(self.layers) if isinstance(l, ParamMixin)), 0) self.layers[self.bprop_until].bprop_to_x = False self.collection = self.layers self._initialized = False def setup(self, x_shape, y_shape=None): # Setup layers sequentially if self._initialized: return for layer in self.layers: layer.setup(x_shape) x_shape = layer.y_shape(x_shape) self.loss.setup(x_shape, y_shape) self._initialized = True def update(self, x, y): self.phase = 'train' # Forward propagation y_pred = self.fprop(x) # Backward propagation grad = self.loss.grad(y_pred, y) for layer in reversed(self.layers[self.bprop_until:]): grad = layer.bprop(grad) return self.loss.loss(y_pred, y) def fprop(self, x): for layer in self.layers: x = layer.fprop(x) return x def y_shape(self, x_shape): for layer in self.layers: x_shape = layer.y_shape(x_shape) return x_shape def predict(self, feed): """ Calculate the output for the given input x. """ feed = Feed.from_any(feed) self.phase = 'test' if isinstance(self.loss, SoftmaxCrossEntropy): # Add softmax from SoftmaxCrossEntropy self.layers += [self.loss] y = [] for x_batch, in feed.batches(): y.append(np.array(self.fprop(x_batch))) y = np.concatenate(y)[:feed.n_samples] if isinstance(self.loss, SoftmaxCrossEntropy): self.layers = self.layers[:-1] return y
m-nakagawa/sample
jena-3.0.1/jena-sdb/src/main/java/org/apache/jena/sdb/script/QExec.java
/* * 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 org.apache.jena.sdb.script; import org.apache.jena.query.Query ; import org.apache.jena.query.QueryExecution ; import org.apache.jena.sparql.resultset.ResultsFormat ; import org.apache.jena.sparql.util.QueryExecUtils ; public class QExec { private Query query ; private QueryExecution exec ; private ResultsFormat format ; public QExec(Query query, QueryExecution exec, ResultsFormat format) { this.query = query ; this.exec = exec ; this.format = format ; } public void exec() { QueryExecUtils.executeQuery(query, exec, format) ; } }
my-digital-decay/Polycode
include/polycode/bindings/lua/PolycodeLua.h
#pragma once #include <Polycode.h> extern "C" { #include <stdio.h> #include "lua.h" #include "lualib.h" #include "lauxlib.h" int _PolyExport luaopen_Polycode(lua_State *L); }
IBM/oct-glaucoma-forecast
revised/training/scripts/test_reconstruction_mlode.py
<reponame>IBM/oct-glaucoma-forecast import os import numpy as np from data.utils import mask_rnfl from scripts.datautils import MatchedTestSet, save_error from scripts.eval_mlode_sync import evaluate_reconstruction_error, create_vft_mask from train_multimodal_latentodegru_sync import getConfig from utils.oct_utils import get_quardrants import torch np.set_printoptions(precision=2) import tempfile import cv2 def boxplot(e, show=True): import matplotlib.pyplot as plt fig = plt.figure(1, figsize=(9, 6)) ax = fig.add_subplot(121) ax.set_title('RNFL') data_to_plot = list(np.clip(e[:, 0, 0], 0, 15)) # create N_t lists each of size N_samples bp = ax.boxplot(data_to_plot) ax.set_xticklabels(['#visits3', '#visits2', '#nvisits1']) ax.set_ylabel('MAE micron') ax.get_xaxis().tick_bottom() ax.get_yaxis().tick_left() ax = fig.add_subplot(122) ax.set_title('VFT') data_to_plot = list(np.clip(e[:, 0, 2], 0, 9)) # create N_t lists each of size N_samples bp = ax.boxplot(data_to_plot) ax.set_xticklabels(['#visits3', '#visits2', '#nvisits1']) ax.set_ylabel('MAE DB') ax.get_xaxis().tick_bottom() ax.get_yaxis().tick_left() temp_file = os.path.join(tempfile.gettempdir(), 'box_plot.jpeg') plt.savefig(temp_file) if (show): plt.show() im = cv2.imread(temp_file, cv2.IMREAD_COLOR) return im def boxplotv1(e_rnfl, e_vft, show=True): import matplotlib.pyplot as plt fig = plt.figure(1, figsize=(9, 6)) ax = fig.add_subplot(121) ax.set_title('RNFL') data_to_plot = e_rnfl # create N_t lists each of size N_samples bp = ax.boxplot(data_to_plot) ax.set_xticklabels(['#visits3', '#visits2', '#nvisits1']) ax.set_ylabel('MAE micron') ax.get_xaxis().tick_bottom() ax.get_yaxis().tick_left() ax = fig.add_subplot(122) ax.set_title('VFT') data_to_plot = e_vft # create N_t lists each of size N_samples bp = ax.boxplot(data_to_plot) ax.set_xticklabels(['#visits3', '#visits2', '#nvisits1']) ax.set_ylabel('MAE DB') ax.get_xaxis().tick_bottom() ax.get_yaxis().tick_left() temp_file = os.path.join(tempfile.gettempdir(), 'box_plot.jpeg') plt.savefig(temp_file) if (show): plt.show() im = cv2.imread(temp_file, cv2.IMREAD_COLOR) return im def boxplot_rnfl(e_rnfl, show=True, title='RNFL', showmeans=True): import matplotlib.pyplot as plt fig = plt.figure(1, figsize=(9, 6)) ax = fig.add_subplot(111) ax.set_title(title) data_to_plot = e_rnfl # create N_t lists each of size N_samples bp = ax.boxplot(data_to_plot, showmeans=showmeans) plt.ylim([0, 20]) major_ticks = np.arange(0, 20, 5) minor_ticks = np.arange(0, 20, 1) ax.set_yticks(major_ticks) ax.set_yticks(minor_ticks, minor=True) ax.grid(b=True, which='both') # HHYU: disabled temporarily #ax.set_xticklabels(['#visits3', '#visits2', '#nvisits1']) ax.set_ylabel('MAE micron') ax.get_xaxis().tick_bottom() ax.get_yaxis().tick_left() temp_file = os.path.join(tempfile.gettempdir(), 'box_plot_rnfl.jpeg') plt.savefig(temp_file) if (show): plt.show() im = cv2.imread(temp_file, cv2.IMREAD_COLOR) return im def boxplot_vft(e_vft, show=True, title='VFT', showmeans=True): import matplotlib.pyplot as plt fig = plt.figure(1, figsize=(9, 6)) ax = fig.add_subplot(111) ax.set_title(title) data_to_plot = e_vft # create N_t lists each of size N_samples bp = ax.boxplot(data_to_plot, showmeans=showmeans) plt.ylim([0, 10]) major_ticks = np.arange(0, 10, 5) minor_ticks = np.arange(0, 10, 1) ax.set_yticks(major_ticks) ax.set_yticks(minor_ticks, minor=True) ax.grid(b=True, which='both') # HHYU: disabled temporarily #ax.set_xticklabels(['#visits3', '#visits2', '#nvisits1']) ax.set_ylabel('MAE DB') ax.get_xaxis().tick_bottom() ax.get_yaxis().tick_left() temp_file = os.path.join(tempfile.gettempdir(), 'box_plot_vft.jpeg') plt.savefig(temp_file) if (show): plt.show() im = cv2.imread(temp_file, cv2.IMREAD_COLOR) return im def line_plot(e, show=True): import matplotlib.pyplot as plt fig = plt.figure(2, figsize=(9, 6)) plt.subplot(1, 2, 1) plt.title('RNFL') plt.ylim([2, 5]) plt.plot([3, 2, 1], np.mean(e[:, 0, 0], axis=1), 'g') # RNFL for [1,0,1] plt.plot([3, 2, 1], np.mean(e[:, 1, 0], axis=1), 'b') # #RNFL for [1,0,0] plt.plot([3, 2, 1], np.mean(e[:, 2, 0], axis=1), 'r') # #RNFL for [0,0,1] plt.xlabel('#nvisits') plt.ylabel('MAE micron') plt.subplot(1, 2, 2) plt.title('VFT') plt.ylim([2.5, 4.5]) plt.plot([3, 2, 1], np.mean(e[:, 0, 2], axis=1), 'g') # VFT for [1,0,1] plt.plot([3, 2, 1], np.mean(e[:, 2, 2], axis=1), 'b') # VFT for [0,0,1] plt.plot([3, 2, 1], np.mean(e[:, 1, 2], axis=1), 'r') # VFT for [1,0,0] plt.xlabel('#nvisits') plt.ylabel('MAE DB') temp_file = os.path.join(tempfile.gettempdir(), 'line_plot.jpeg') plt.savefig(temp_file) if (show): plt.show() im = cv2.imread(temp_file, cv2.IMREAD_COLOR) return im # HHYU: change default to 7mm (instead of 6) def compute_rnfl_error_base(rnfl, rnfl_pred, rnfl_dia_mm=7, disc_dia_mm=1.92, use_ma=False, quadrant=None, mode='forecast'): """ :param rnfl: (N, T,1,H,W) :param rnfl_pred: (N, T,1,H,W) :param rnfl_dia_mm: :param disc_dia_mm: :param use_ma: :param quadrant: :param mode: :return: """ rnfl_masked, mask = mask_rnfl(rnfl, channel_last=False, rnfl_diam_mm=rnfl_dia_mm) rnfl_pred_masked, _ = mask_rnfl(rnfl_pred, channel_last=False, rnfl_diam_mm=rnfl_dia_mm) if (quadrant is not None): qm = get_quardrants(rnfl_diam_mm=rnfl_dia_mm, image_size_return=rnfl.shape[3], disc_dia_mm=disc_dia_mm) mask = qm[quadrant] mask = np.expand_dims(mask, 0).astype(np.bool) if (use_ma): mask = mask[np.newaxis, np.newaxis, :, :, :].repeat(rnfl.shape[0], axis=0).repeat(rnfl.shape[1], axis=1) rnfl_masked = np.ma.masked_array(rnfl, mask=~mask) rnfl_pred_masked = np.ma.masked_array(rnfl_pred, mask=~mask) if (mode == 'forecast'): rnfl_masked = rnfl_masked[:, [-1]] rnfl_pred_masked = rnfl_pred_masked[:, [-1]] # MAE error errors = np.mean(np.abs(rnfl_masked - rnfl_pred_masked).reshape(rnfl_masked.shape[0], -1), axis=1) * 200 err, std = np.mean(errors), np.std(errors) # global_mean errors_gm = np.abs(np.mean(rnfl_masked.reshape(rnfl_masked.shape[0], -1), axis=1) - np.mean( rnfl_pred_masked.reshape(rnfl.shape[0], -1), axis=1)) * 200 err_gm, std_gm = np.mean(errors_gm), np.std(errors_gm) return [err, std], [err_gm, std_gm], [errors, errors_gm] def compute_rnfl_error(inputs, preds, rnfl_dia_mm=6, disc_dia_mm=1.92, use_ma=False, quadrant=None, mode='forecast', comb_index=0): """ Computes RNFL error- MAE, gobal mean and :param inputs: :param preds: :param rnfl_dia_mm: :param disc_dia_mm: :param use_ma: :param quadrant: :param mode: :comb_index inputs or preds[comb_index] [0], length of preds[0] is 3 ie for 11, 01 annd 10 inputs :return: """ rnfl = inputs[comb_index][0].detach().cpu().numpy() rnfl_pred = preds[comb_index][0].detach().cpu().numpy() rnfl_masked, mask = mask_rnfl(rnfl, channel_last=False, rnfl_diam_mm=rnfl_dia_mm) rnfl_pred_masked, _ = mask_rnfl(rnfl_pred, channel_last=False, rnfl_diam_mm=rnfl_dia_mm) if (quadrant is not None): qm = get_quardrants(rnfl_diam_mm=rnfl_dia_mm, image_size_return=rnfl.shape[3], disc_dia_mm=disc_dia_mm) mask = qm[quadrant] mask = np.expand_dims(mask, 0).astype(np.bool) if (use_ma): mask = mask[np.newaxis, np.newaxis, :, :, :].repeat(rnfl.shape[0], axis=0).repeat(rnfl.shape[1], axis=1) rnfl_masked = np.ma.masked_array(rnfl, mask=~mask) rnfl_pred_masked = np.ma.masked_array(rnfl_pred, mask=~mask) if (mode == 'forecast'): rnfl_masked = rnfl_masked[:, [-1]] rnfl_pred_masked = rnfl_pred_masked[:, [-1]] # MAE error errors = np.mean(np.abs(rnfl_masked - rnfl_pred_masked).reshape(rnfl_masked.shape[0], -1), axis=1) * 200 err, std = np.mean(errors), np.std(errors) # global_mean errors_gm = np.abs(np.mean(rnfl_masked.reshape(rnfl_masked.shape[0], -1), axis=1) - np.mean( rnfl_pred_masked.reshape(rnfl.shape[0], -1), axis=1)) * 200 err_gm, std_gm = np.mean(errors_gm), np.std(errors_gm) return [err, std], [err_gm, std_gm], [errors, errors_gm] def compute_vft_error_base(vft, vft_pred, mask, mode='forecast'): assert mode in ['forecast', 'rec'], 'Mode shold be one of forecast or rec' # mask = mask[np.newaxis, np.newaxis, :, :, :].repeat(vft.shape[0], axis=0).repeat(vft.shape[1], axis=1) vft_masked = np.ma.masked_array(vft, mask=~mask) vft_pred_masked = np.ma.masked_array(vft_pred, mask=~mask) if (mode == 'forecast'): vft_masked = vft_masked[:, [-1]] vft_pred_masked = vft_pred_masked[:, [-1]] else: vft_masked = vft_masked[:, :-1] vft_pred_masked = vft_pred_masked[:, :-1] vft_masked = vft_masked.reshape((vft_masked.shape[0] * vft_masked.shape[1], -1)) vft_pred_masked = vft_pred_masked.reshape((vft_pred_masked.shape[0] * vft_pred_masked.shape[1], -1)) # MAE error errors = np.mean(np.abs(vft_masked - vft_pred_masked).reshape(vft_masked.shape[0], -1), axis=1) * 40 err, std = np.mean(errors), np.std(errors) return [err, std], errors def compute_vft_error(inputs, preds, mode='forecast', exp_ind=0): """ :param inputs: :param preds: :param mode: :param exp_ind: represents different combination of inputs 0 - vft,rnfl, 1- rnfl only, 2 vft only :return: """ vft = inputs[exp_ind][2] vft_pred = preds[exp_ind][2] mask = create_vft_mask(vft) vft = vft.cpu().numpy() vft_pred = vft_pred.cpu().numpy() mask = mask.cpu().numpy() mask = mask.astype(np.bool) # mask = mask[np.newaxis, np.newaxis, :, :, :].repeat(vft.shape[0], axis=0).repeat(vft.shape[1], axis=1) vft_masked = np.ma.masked_array(vft, mask=~mask) vft_pred_masked = np.ma.masked_array(vft_pred, mask=~mask) if (mode == 'forecast'): vft_masked = vft_masked[:, [-1]] vft_pred_masked = vft_pred_masked[:, [-1]] else: vft_masked = vft_masked[:, :-1] vft_pred_masked = vft_pred_masked[:, :-1] vft_masked = vft_masked.reshape((vft_masked.shape[0] * vft_masked.shape[1], -1)) vft_pred_masked = vft_pred_masked.reshape((vft_pred_masked.shape[0] * vft_pred_masked.shape[1], -1)) # MAE error errors = np.mean(np.abs(vft_masked - vft_pred_masked).reshape(vft_masked.shape[0], -1), axis=1) * 40 err, std = np.mean(errors), np.std(errors) return [err, std], errors def compare_prediction_images(preds, inputs, errors, save_dir): import matplotlib matplotlib.rcParams.update({'font.size': 14}) if (not os.path.exists(save_dir)): os.mkdir(save_dir) import matplotlib.pyplot as plt gt_vft = inputs[0][1] pred_vft = preds[0][1] err_vft = errors[0][1] gt_rnfl = inputs[0][0] pred_rnfl = preds[0][0] err_rnfl = errors[0][0] # indices 66, 5, 70 indices = range(gt_rnfl.shape[0]) for idx in indices: # idx = np.argmin(err_vft) # vft plt.subplot(221) showvft = lambda x: plt.imshow(x[2:-2, 2:-2], cmap='gray') pos = showvft(gt_vft[idx, -1, 0] * 40) plt.colorbar(pos) plt.clim(0, 40) plt.title('ground truth') plt.axis('off') plt.subplot(222) pos = showvft(pred_vft[idx, -1, 0] * 40) plt.colorbar(pos) plt.clim(0, 40) plt.title('forecast') plt.axis('off') # rnfl plt.subplot(223) pos = plt.imshow(gt_rnfl[idx, -1, 0] * 200, cmap='jet') plt.colorbar(pos) plt.clim(0, 200) #plt.title('ground truth RNFL-TM') plt.axis('off') plt.subplot(224) pos = plt.imshow(pred_rnfl[idx, -1, 0] * 200, cmap='jet') plt.colorbar(pos) plt.clim(0, 200) #plt.title('forecast RNFL-TM') plt.axis('off') # plt.show() plt.suptitle('R{:.2f}, V{:.2f}'.format(err_rnfl[idx], err_vft[idx])) plt.savefig(os.path.join(save_dir, 'results' + str(idx)) + '.jpeg') plt.close() def compare_prediction_imagesV1(preds, inputs, errors, save_dir): import matplotlib matplotlib.rcParams.update({'font.size': 14}) if (not os.path.exists(save_dir)): os.mkdir(save_dir) import matplotlib.pyplot as plt gt_vft = inputs[0][1] pred_vft = preds[0][1] gt_vft = gt_vft[:, :, :, 2:-2, 2:-2] pred_vft = pred_vft[:, :, :, 2:-2, 2:-2] err_vft = errors[0][1] gt_rnfl = inputs[0][0] pred_rnfl = preds[0][0] err_rnfl = errors[0][0] def resize(x): out = torch.nn.functional.interpolate(x, size=(32, 32), mode='bicubic', align_corners=False) return out def stack_tensor(x, pred, pad=0): """ :param x: (T,c, H,W) tensor :param pred: (T,c, H,W) tensor :return: # c, H, T*W' image where W' is effective width after padding """ x = torch.cat([x, pred[ [-1], :, :, :]], dim=0) padder = torch.nn.ZeroPad2d((1,1,0,0)) x=padder(x) #x = resize(x) out=torch.cat(list(x), dim=2) return out # indices 66, 5, 70 indices = range(gt_rnfl.shape[0]) for idx in indices: # idx = np.argmin(err_vft) # vft out_vft = stack_tensor(gt_vft[idx], pred_vft[idx]) out_rnfl = stack_tensor(gt_rnfl[idx], pred_rnfl[idx]) plt.subplot(2,1,1) pos= plt.imshow(out_vft[0]* 40, cmap='gray') plt.colorbar(pos) plt.clim(0, 40) plt.axis('off') plt.subplot(2, 1, 2) pos = plt.imshow(out_rnfl[0] * 200, cmap='jet') plt.colorbar(pos) plt.clim(0, 200) plt.axis('off') plt.suptitle('R{:.2f}, V{:.2f}'.format(err_rnfl[idx], err_vft[idx])) plt.savefig(os.path.join(save_dir, 'results_traj' + str(idx)) + '.jpeg') plt.close() if (__name__ == '__main__'): # modalities_exp = [ [1,0,0],[0,0,1],[1, 0, 1]] modalities_exp = [[1, 1]] # [[1, 0, 1]] experts = ['poe'] # ,'poe'] fold_seed = 2 results = {} # for seed 2 idx_r = [107, 342, 191, 325, 20, 330, 155, 329, 340, 85, 324, 162, 3] # for [1,1] input filter rnfl comb index=0 # idx_r = [ 84, 324, 162, 3] # filter for [1,0] input ie rnfl comb index=2 # rnfl_comb_Index 0 - inputs 11 and 2 means 1,0 and 1 means 01 the input comb in format [rnfl, vft] #rnfl_comb_index = 2 # data = MultimodalTimeSeriesData(fold_seed=fold_seed, idx_r=idx_r) data = MatchedTestSet() print('Number of test samples', data.val_rnflonh.shape[0]) # suffix_model_path ='_epoch15_rnflerr272'# '' suffix_model_path = '' for ei, expert in enumerate(experts): for mi, mm in enumerate(modalities_exp): Config = getConfig(mm, expert, latent_dim_=32, fold_seed_=fold_seed) config = Config() config.model = config.create_model(load_weights=True, suffix_model_path=suffix_model_path) results[expert + str(mm)] = [[], []] savedir = os.path.join(config.LOG_ROOT_DIR, 'testdata') if (not os.path.exists(savedir)): os.mkdir(savedir) key = expert + str(mm) errors_quads = [] nvisits_all = [] errors_rnfl_all = [] errors_vft_all = [] ## variable visit but target index is fixed, use MatchedTestSet exp_type = 'num_visits' #for nv_fc, si, ti in zip([1, 2, 3, 4, 5], [4, 3, 2, 1, 0], [-1,-1, -1, -1,-1]): #for nv_fc, si, ti in zip([4, 5], [ 1, 0], [ -1, -1]):# only few check ##fixed visit and target index is moved to increase gap (note 0,0, 1 in si) to make sure e inc, ##use this with MatchedTesSet which gives data of sequence length=6 exp_type = 'larger_gap' for nv_fc, si, ti in zip([3, 3, 3], [0, 0, 0], [3, 4, 5]): print('# NV ', nv_fc) errors, inputs_c, preds, inputs = evaluate_reconstruction_error(config, data, mode='forecast', nv_fc=nv_fc, start_index=si, target_index=ti) print(config.prefix) results[key][0].append(errors) results[key][1].append([inputs, preds, inputs_c]) # compute_vft_error(inputs, preds,mode='forecast', exp_ind=0) # save forecasting predictions if(nv_fc >0): #compare_prediction_imagesV1(preds, inputs, errors, # save_dir=os.path.join(config.LOG_ROOT_DIR, 'testdata', 'viz')) compare_prediction_imagesV1(preds, inputs, errors, save_dir=os.path.join(config.LOG_ROOT_DIR, 'testdata'+exp_type, 'viz_traj' + str(nv_fc)+ str(si)+str(ti) )) if (mm[1] == 1): errors_vft_all.append(errors[1][1]) # for input [0,1] nvisits_all.append(nv_fc) for ii, e in zip(inputs_c, errors): print(ii, ["{0:0.2f}+-{1:0.2f}".format(np.mean(i), np.std(i)) if i is not None else None for i in e]) for rnfl_comb_index in [0,2]: print('RNFL comb index', rnfl_comb_index) if (mm[0] == 1): # [err, std], [err_gm, std_gm] = compute_rnfl_error(inputs, preds, rnfl_dia_mm=6, use_ma=True) [err, std], [err_gm, std_gm], [abs_err, abs_err_gm] = compute_rnfl_error(inputs, preds, rnfl_dia_mm=7, use_ma=True, quadrant=None, comb_index=rnfl_comb_index) if(rnfl_comb_index ==2): errors_rnfl_all.append(abs_err_gm) print('Global [', err_gm, '+-', std_gm, ']') for q in [0, 1, 2, 3]: [err, std], [err_gm, std_gm], [abs_err, abs_err_gm] = compute_rnfl_error(inputs, preds, rnfl_dia_mm=7, use_ma=True, quadrant=q, disc_dia_mm=0.4, comb_index=rnfl_comb_index) print('Quad', q, '[', err_gm, '+-', std_gm, ']') print('saving rnfl errors with means', [np.mean(e) for e in errors_rnfl_all], 'columns', nvisits_all) print('saving vft errors with means', [np.mean(e) for e in errors_vft_all],'columns', nvisits_all) save_error(model_name='mlode_joint', target_modality='rnfl', errors=errors_rnfl_all, nv=nvisits_all, exp_type=exp_type, save_dir='results') save_error(model_name='mlode_joint', target_modality='vft', errors=errors_vft_all, nv=nvisits_all, exp_type=exp_type, save_dir='results') np.save(os.path.join(savedir, 'testdata_forecast.npy'), results[key]) e = np.asanyarray(results[key][0]) e_rnfl = list(np.clip(e[:, 0, 0], 0, 20)) e_vft = list(np.clip(e[:, 0, 2], 0, 15)) # [:,0,2] using rnfl+vft and [:,2,2] only using vft e_rnfl_fromvft = list(np.clip(e[:, 2, 0], 0, 30)) e_vft_fromrnfl = list(np.clip(e[:, 1, 2], 0, 15)) # imbp = boxplotv1(e_rnfl, e_vft, show=True) # cv2.imwrite(os.path.join(savedir, 'box_plot.jpeg'), imbp) # imlp = line_plot(np.asanyarray(e), show=True) # cv2.imwrite(os.path.join(savedir, 'line_plot.jpeg'), imlp) imbp = boxplot_vft(e_vft, title='VFT', show=True) cv2.imwrite(os.path.join(savedir, 'box_plot_vft.jpeg'), imbp) imbp = boxplot_vft(e_vft_fromrnfl, title='VFT from RNFL', show=True) cv2.imwrite(os.path.join(savedir, 'box_plot_vft_from_rnfl.jpeg'), imbp) imbp = boxplot_rnfl(e_rnfl, title='RNFL global mean', show=True) cv2.imwrite(os.path.join(savedir, 'box_plot_rnfl_global.jpeg'), imbp) imbp = boxplot_rnfl(e_rnfl_fromvft, title='RNFL from VFT', show=True) cv2.imwrite(os.path.join(savedir, 'box_plot_rnfl_from_vft.jpeg'), imbp) # quadrants errors_quads = np.asanyarray(errors_quads) loc = ['Superior', 'Inferior', 'Temporal', 'Nasal'] for i in range(errors_quads.shape[1]): imbp = boxplot_rnfl(list(errors_quads[:, i, :]), title='RNFL ' + loc[i], show=True) cv2.imwrite(os.path.join(savedir, 'box_plot_rnfl' + loc[i] + '.jpeg'), imbp)
mathiasbynens/unicode-data
6.3.0/scripts/Brahmi-regex.js
<filename>6.3.0/scripts/Brahmi-regex.js<gh_stars>10-100 // Regular expression that matches all symbols in the `Brahmi` script as per Unicode v6.3.0: /\uD804[\uDC00-\uDC4D\uDC52-\uDC6F]/;
Caesar73/chineseclub
public/src/js/libs/src/TouchSlide.js
<filename>public/src/js/libs/src/TouchSlide.js<gh_stars>0 /*! * TouchSlide v1.1 * javascript触屏滑动特效插件,移动端滑动特效,触屏焦点图,触屏Tab切换,触屏多图切换等 * 详尽信息请看官网:http://www.SuperSlide2.com/TouchSlide/ * * Copyright 2013 大话主席 * * 请尊重原创,保留头部版权 * 在保留版权的前提下可应用于个人或商业用途 * 1.1 宽度自适应(修复安卓横屏时滑动范围不变的bug) */ /*! AniJS - http://anijs.github.io Licensed under the MIT license Copyright (c) 2014 <NAME> <<EMAIL>> Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ ;(function (root, factory) { "use strict"; if (typeof module == "object" && typeof module.exports == "object") { module.exports = root.document ? factory(root, true) : function (w) { if (!w.document) { throw new Error("AniJS requires a window with a document"); } return factory(w); }; } else { factory(root); } })(typeof window !== "undefined"? window : this, function(window, noGlobal) { /** * AniJS is library for write declarative animations in your static html documents * @class AniJSit * @constructor initializer * @author @dariel_noel */ var TouchSlideLib = function() { var instance = this; /** * Initializer Function * @method initializer * @return */ instance._initializer = function() { }; /** * Parse Declarations and setup Anim in a founded elements * @method run * @return */ instance.init = function (a) { a = a||{}; var opts = { slideCell:a.slideCell || "#touchSlide", //运行效果主对象,必须用id!,例如 slideCell:"#touchSlide" titCell:a.titCell || ".hd li", // 导航对象,当自动分页设为true时为“导航对象包裹层” mainCell:a.mainCell || ".bd", // 切换对象包裹层 effect:a.effect || "left", // 效果,支持 left、leftLoop autoPlay:a.autoPlay || false, // 自动播放 delayTime:a.delayTime || 200, // 效果持续时间 interTime:a.interTime ||2500, // 自动运行间隔 defaultIndex:a.defaultIndex ||0, // 默认的当前位置索引。0是第一个; defaultIndex:1 时,相当于从第2个开始执行 titOnClassName:a.titOnClassName ||"on", // 当前导航对象添加的className titType: a.titType || 'default', autoPage:a.autoPage || false, // 自动分页,当为true时titCell为“导航对象包裹层” prevCell:a.prevCell ||".prev", // 前一页按钮 nextCell:a.nextCell ||".next", // 后一页按钮 pageStateCell:a.pageStateCell ||".pageState", // 分页状态对象,用于显示分页状态,例如:2/3 pnLoop:a.pnLoop=='undefined '?true:a.pnLoop , // 前后按钮点击是否继续执行效果,当为最前/后页是会自动添加“prevStop”/“nextStop”控制样色 startFun:a.startFun || null, // 每次切换效果开始时执行函数,用于处理特殊情况或创建更多效果。用法 satrtFun:function(i,c){ }; 其中i为当前分页,c为总页数 endFun:a.endFun || null, // 每次切换效果结束时执行函数,用于处理特殊情况或创建更多效果。用法 endFun:function(i,c){ }; 其中i为当前分页,c为总页数 switchLoad:a.switchLoad || null, //每次切换效果结束时执行函数,用于处理特殊情况或创建更多效果。用法 endFun:function(i,c){ }; 其中i为当前分页,c为总页数 isTravelNotes: a.isTravelNotes || false // 是否启用游记模式排版 } var slideCell = document.getElementById(opts.slideCell.replace("#","")); if( !slideCell ) return false; //简单模拟jquery选择器 var obj = function(str,parEle){ str = str.split(" "); var par = []; parEle = parEle||document; var retn = [ parEle ] ; for( var i in str ){ if(str[i].length!=0) par.push(str[i]) } //去掉重复空格 for( var i in par ){ if( retn.length==0 ) return false; var _retn = []; for ( var r in retn ) { if( par[i][0] =="#" ) _retn.push( document.getElementById( par[i].replace("#","") ) ); else if( par[i][0] =="." ){ var tag = retn[r].getElementsByTagName('*'); for( var j=0; j<tag.length; j++ ){ var cln = tag[j].className; if( cln && cln.search(new RegExp("\\b" + par[i].replace(".","") + "\\b"))!=-1 ){ _retn.push( tag[j] ); } } } else { var tag = retn[r].getElementsByTagName( par[i] ); for( var j=0; j<tag.length; j++ ){ _retn.push( tag[j] ) } } } retn =_retn; } return retn.length==0 || retn[0] == parEle ? false:retn; }// obj E // 创建包裹层 var wrap = function(el, v){ var tmp = document.createElement('div'); tmp.innerHTML = v; tmp = tmp.children[0]; var _el = el.cloneNode(true); tmp.appendChild(_el); el.parentNode.replaceChild(tmp, el); conBox = _el; // 重置conBox return tmp; }; // 获取样色数值 var getStyleVal =function(el, attr){ var v=0; if(el.currentStyle){ v= el.currentStyle[attr] } else { v= getComputedStyle(el,false)[attr]; } return parseInt(v.replace("px","")) } // class处理 var addClass =function(ele, className){ if (!ele || !className || (ele.className && ele.className.search(new RegExp("\\b" + className + "\\b")) != -1)) return; ele.className += (ele.className ? " " : "") + className; } var removeClass = function(ele, className){ if (!ele || !className || (ele.className && ele.className.search(new RegExp("\\b" + className + "\\b")) == -1)) return; ele.className = ele.className.replace(new RegExp("\\s*\\b" + className + "\\b", "g"), ""); } //全局对象 var effect = opts.effect; var prevBtn = obj( opts.prevCell,slideCell )[0]; var nextBtn = obj( opts.nextCell,slideCell )[0]; var pageState = obj( opts.pageStateCell )[0]; var conBox = obj( opts.mainCell,slideCell )[0];//内容元素父层对象 if( !conBox ) return false; var conBoxSize= conBox.children.length; var navObj = obj( opts.titCell,slideCell );//导航子元素结合 var navObjSize = navObj?navObj.length:conBoxSize; var sLoad=opts.switchLoad; /*字符串转换*/ var index=parseInt(opts.defaultIndex); var delayTime=parseInt(opts.delayTime); var interTime=parseInt(opts.interTime); var autoPlay = (opts.autoPlay=="false"||opts.autoPlay==false)?false:true; var autoPage = (opts.autoPage=="false"||opts.autoPage==false)?false:true; var loop = (opts.pnLoop=="false"||opts.pnLoop==false)?false:true; var oldIndex = index; var inter=null;// autoPlay的setInterval var timeout = null; // leftLoop的setTimeout var endTimeout = null; //translate的setTimeout var startX = 0; var startY = 0; var distX = 0; var distY = 0; var dist = 0; //手指滑动距离 var isTouchPad = (/hp-tablet/gi).test(navigator.appVersion); var hasTouch = 'ontouchstart' in window && !isTouchPad; var touchStart = hasTouch ? 'touchstart' : 'mousedown'; //var touchMove = hasTouch ? 'touchmove' : 'mousemove'; var touchMove = hasTouch ? 'touchmove' : ''; var touchEnd = hasTouch ? 'touchend' : 'mouseup'; var slideH=0; var slideW= conBox.parentNode.clientWidth;// mainCell滑动距离 var twCell; var scrollY ; var tempSize = conBoxSize; //处理分页 if( navObjSize==0 )navObjSize=conBoxSize; if( autoPage ){ navObjSize=conBoxSize; navObj=navObj[0]; navObj.innerHTML=""; var str=""; if( opts.autoPage==true|| opts.autoPage=="true" ){ for( var i=0; i<navObjSize; i++ ){ str+="<li>"+(i+1)+"</li>" } } else{ for( var i=0; i<navObjSize; i++ ){ str+=opts.autoPage.replace("$",(i+1)) } } navObj.innerHTML=str; navObj = navObj.children;//重置navObj } else { } if( effect == "leftLoop" ){ tempSize +=2; conBox.appendChild( conBox.children[0].cloneNode(true) ); conBox.insertBefore( conBox.children[conBoxSize-1].cloneNode(true),conBox.children[0] ); } twCell = wrap(conBox,'<div class="tempWrap" style="overflow:hidden; position:relative;"></div>'); conBox.style.cssText="width:"+tempSize*slideW+"px;"+"position:relative;overflow:hidden;padding:0;margin:0;"; for ( var i =0; i<tempSize; i++ ){ conBox.children[i].style.cssText="display:table-cell;vertical-align:top;width:"+slideW+"px" } var doStartFun=function(){ if ( typeof opts.startFun =='function' ){ opts.startFun( index,navObjSize ) } } var doEndFun=function(){ if ( typeof opts.endFun =='function' ){ opts.endFun( index,navObjSize ) } } var doSwitchLoad=function( moving ){ var curIndex = ( effect=="leftLoop"?index+1:index ) + moving; var changeImg = function( ind ){ var img; if (conBox.children[ind]) { img = conBox.children[ind].getElementsByTagName("img"); } else { return false; } for ( var i=0; i<img.length ; i++ ) { if ( img[i].getAttribute(sLoad) ){ img[i].setAttribute("src", img[i].getAttribute(sLoad) ); img[i].removeAttribute( sLoad ); } } }// changeImg E changeImg( curIndex ); if( effect=="leftLoop" ){ switch ( curIndex ) { case 0: changeImg( conBoxSize );break; case 1: changeImg( conBoxSize+1 );break; case conBoxSize: changeImg( 0 );break; case conBoxSize+1: changeImg( 1 );break; } } }// doSwitchLoad E //动态设置滑动宽度 var orientationChange = function(){ slideW = twCell.clientWidth; conBox.style.width = tempSize*slideW +"px"; for ( var i =0; i<tempSize; i++ ){ conBox.children[i].style.width=slideW+"px"; } var ind = effect == "leftLoop"? index+1:index; translate( -ind*slideW ,0 ); } window.addEventListener("resize", orientationChange, false); //滑动效果 var translate = function( dist, speed, ele ) { if( !!ele ){ ele=ele.style; }else{ ele=conBox.style; } ele.webkitTransitionDuration = ele.MozTransitionDuration = ele.msTransitionDuration = ele.OTransitionDuration = ele.transitionDuration = speed + 'ms'; ele.webkitTransform = 'translate(' + dist + 'px,0)' + 'translateZ(0)'; ele.msTransform = ele.MozTransform = ele.OTransform = 'translateX(' + dist + 'px)'; } //效果函数 var doPlay=function(isTouch){ switch (effect) { case "left": if ( index >= navObjSize) { index = isTouch?index-1:0; } else if( index < 0) { index = isTouch?0:navObjSize-1; } if( sLoad!=null ){ doSwitchLoad(0) } translate( (-index*slideW),delayTime ); oldIndex=index; break; case "leftLoop": if( sLoad!=null ){ doSwitchLoad(0) } translate( -(index+1)*slideW ,delayTime ); if ( index==-1){ timeout= setTimeout( function(){ translate( -navObjSize*slideW ,0 ); }, delayTime ); index = navObjSize-1; } else if( index==navObjSize ){ timeout= setTimeout( function(){ translate( -slideW ,0 ); }, delayTime ); index = 0; } oldIndex=index; break;// leftLoop end }//switch end doStartFun(); endTimeout= setTimeout( function(){ doEndFun() }, delayTime ); //设置className if (opts.titType == 'present') { for ( var i=0; i < navObjSize; i++ ) { console.log(i + '-' + index) if (i <= index) { addClass(navObj[i],opts.titOnClassName) } else { removeClass(navObj[i],opts.titOnClassName); } } // for ( var i=0; i<navObjSize; i++ ) // { // removeClass(navObj[i],opts.titOnClassName); // if( i == index ){ addClass(navObj[i],opts.titOnClassName) } // } if( loop==false ){ //loop控制是否继续循环 removeClass( nextBtn,"nextStop" );removeClass( prevBtn,"prevStop" ); if (index==0 ){ addClass( prevBtn,"prevStop" ) } else if (index==navObjSize-1 ){ addClass( nextBtn,"nextStop" ) } } if(pageState){ pageState.innerHTML= "<span>"+(index+1)+"</span>/"+navObjSize; } } else if (opts.titType == 'number') { } else { for ( var i=0; i<navObjSize; i++ ) { removeClass(navObj[i],opts.titOnClassName); if( i == index ){ addClass(navObj[i],opts.titOnClassName) } } if( loop==false ){ //loop控制是否继续循环 removeClass( nextBtn,"nextStop" );removeClass( prevBtn,"prevStop" ); if (index==0 ){ addClass( prevBtn,"prevStop" ) } else if (index==navObjSize-1 ){ addClass( nextBtn,"nextStop" ) } } if(pageState){ pageState.innerHTML= "<span>"+(index+1)+"</span>/"+navObjSize; } } if (opts.isTravelNotes) { var wH = $(window).height(); $('#list-detail').height(wH); var headerH = $('#list-detail header').height(); var picScroll = $('#picScroll'); picScroll.height(wH - headerH); var hd = picScroll.find('.hd'); // var hdH = hd.height(); var hdH = 3; picScroll.find('.tempWrap, .bd, .bd>section').height(wH - hdH - headerH); var section = picScroll.find('section').eq(index); var title = section.find('.title').height() || 0; var imgBoard = section.find('.imgBoard').height() || 0;; var content = section.find('.content'); var contentH = wH - hdH - title - imgBoard - headerH; console.log('contentH: ' + contentH + ', wH: ' + wH + ', hdH: ' + hdH + ', title:' + title + ', imgBoard: ' + imgBoard + ', headerH: ' + headerH); content.height(contentH); // var total = $('bd>section').size(); // picScroll.find('section').height(wH -hdH); // picScroll.find('.bd').height(wH -hdH); var precent = (index+1)*100 / parseInt(navObjSize); console.log('precent: ' + precent); $('.progress-bar').css('width', precent + '%'); if (window._platform == 'native') { var detail = $('#list-detail'); var picScroll = detail.find('#picScroll'); var tempWrap = detail.find('.tempWrap'); detail.find('.header').hide(); var dh = detail.height(); picScroll.height( dh ); tempWrap.height( dh ); detail.find('.bd').height( dh ); detail.find('.bd section').height( dh ); var ch = dh - detail.find('.title').height() - detail.find('.imgBoard').height(); detail.find('.bd section .content').height( ch ); detail.find('.content p').css({ 'padding-top': '0rem' }); picScroll.css({ 'padding-top': '0rem' }); // #detail/native/index/1 } } };// doPlay end //初始化执行 doPlay(); //自动播放 if (autoPlay) { inter=setInterval(function(){ index++; doPlay() }, interTime); } //点击事件 if( navObj ){ for ( var i=0; i<navObjSize; i++ ) { (function(){ var j = i; navObj[j].addEventListener('click', function(e){ clearTimeout( timeout ); clearTimeout( endTimeout ); index=j; doPlay(); }) })() } } if(nextBtn){ nextBtn.addEventListener('click', function(e){ if ( loop==true || index!=navObjSize-1 ){ clearTimeout( timeout ); clearTimeout( endTimeout ); index++; doPlay(); } }) } if(prevBtn){ prevBtn.addEventListener('click', function(e){ if ( loop==true || index!=0 ){ clearTimeout( timeout ); clearTimeout( endTimeout ); index--; doPlay(); } }) } //触摸开始函数 var tStart = function(e){ clearTimeout( timeout );clearTimeout( endTimeout ); scrollY = undefined; distX = 0; var point = hasTouch ? e.touches[0] : e; startX = point.pageX; startY = point.pageY; //添加“触摸移动”事件监听 conBox. addEventListener(touchMove, tMove,false); //添加“触摸结束”事件监听 conBox.addEventListener(touchEnd, tEnd ,false); } //触摸移动函数 var tMove = function(e){ if( hasTouch ){ if ( e.touches.length > 1 || e.scale && e.scale !== 1) return }; //多点或缩放 var point = hasTouch ? e.touches[0] : e; distX = point.pageX-startX; distY = point.pageY-startY; if ( typeof scrollY == 'undefined') { scrollY = !!( scrollY || Math.abs(distX) < Math.abs(distY) ); } if( !scrollY ){ e.preventDefault(); if(autoPlay){clearInterval(inter) } switch (effect){ case "left": if( (index==0 && distX>0) || (index>=navObjSize-1&&distX<0 )){ distX=distX*0.4 } translate( -index*slideW+distX ,0 ); break; case "leftLoop":translate( -(index+1)*slideW+distX ,0 );break; } if( sLoad!=null && Math.abs(distX)>slideW/3 ){ doSwitchLoad( distX>-0?-1:1 ) } } } //触摸结束函数 var tEnd = function(e){ if(distX==0) return; e.preventDefault(); if( !scrollY ) { if( Math.abs(distX) > slideW/10 ){ distX>0? index--: index++; } doPlay( true ); if (autoPlay) { inter=setInterval(function(){ index++; doPlay() }, interTime); } } conBox.removeEventListener(touchMove, tMove, false); conBox.removeEventListener(touchEnd, tEnd, false); } //添加“触摸开始”事件监听 conBox.addEventListener(touchStart, tStart ,false); }; /** * Thanks a lot to underscore guys * @method isFunction * @param {} obj * @return UnaryExpression */ instance._isFunction = function(obj) { return !!(obj && obj.constructor && obj.call && obj.apply); }; // instance._initializer(); }; var TouchSlide = new TouchSlideLib(); // TouchSlide.run(); // https://github.com/jrburke/requirejs/wiki/Updating-existing-libraries#wiki-anon // AMD Support if ( typeof define === "function" && define.amd ) { define( "touchSlide", [], function() { return TouchSlide; }); } if (typeof noGlobal == typeof undefined) { window.TouchSlide = TouchSlide; } return TouchSlide; }); // ;(function() { // var TouchSlide = {}; // TouchSlide.prototype = TouchSlide; // // TouchSlide E // // alert(TouchSlide.init); // return TouchSlide; // }.call(this));
moyui/BlogBuild
client/src/constant/actions.js
<filename>client/src/constant/actions.js import { FETCH_STARTED, FETCH_SUCCESS, FETCH_FAILURE } from './actionTypes.js'; export const fetchAItemsStarted = () => { return { type: FETCH_STARTED } }; export const fetchAItemsSuccess = (data) => { return { type: FETCH_SUCCESS, data, } }; export const fetchAItemsFailure = (error) => { return { type: FETCH_FAILURE, error } } export const fetchAItems = (limit, num = 1) => { return async (dispatch) => { const apiUrl = `/v1/articleitems?limit=${limit}&page=${num}`; const headers = new Headers(); headers.append('Accept', 'application/json'); headers.append('Content-Type', 'application/json'); const init = { method: 'get', headers: headers, mode: 'cors' }; dispatch(fetchAItemsStarted()); try { const response = await fetch(apiUrl, init); if (response.status !== 200 || response.ok !== true) { throw new Error(`获取数据失败,错误代码:${response.status}`); } const responseJson = await response.json(); dispatch(fetchAItemsSuccess(responseJson.data)); } catch(error) { console.log(error); dispatch(fetchAItemsFailure(error)); } } }
JackGirl/start-base
services/activiti/src/main/java/cn/ulyer/activiti/service/ActReModelService.java
package cn.ulyer.activiti.service; import com.baomidou.mybatisplus.extension.service.IService; import cn.ulyer.activiti.entity.ActReModel; /** * <p> * 服务类 * </p> * * @author mybatis-plus generator * @since 2021-06-15 */ public interface ActReModelService extends IService<ActReModel> { }
SCSLaboratory/BearOS
usr/include/sys/syslog.h
<filename>usr/include/sys/syslog.h #pragma once /* Modified for Bear (ST) */ /* syslog warning priorities -- needed by dropbear */ #define LOG_EMERG 0 #define LOG_ALERT 1 #define LOG_CRIT 2 #define LOG_ERR 3 #define LOG_WARNING 4 #define LOG_NOTICE 5 #define LOG_INFO 6 #define LOG_DEBUG 7 /* end of mods */
wokalski/Distraction-Free-Xcode-plugin
Archived/v1/WCDistractionFreeXcodePlugin/Headers/PlugIns/IDEInterfaceBuilderKit/IBSourceCodeScanningActivityReporter.h
<reponame>wokalski/Distraction-Free-Xcode-plugin<filename>Archived/v1/WCDistractionFreeXcodePlugin/Headers/PlugIns/IDEInterfaceBuilderKit/IBSourceCodeScanningActivityReporter.h // // Generated by class-dump 3.5 (64 bit). // // class-dump is Copyright (C) 1997-1998, 2000-2001, 2004-2013 by <NAME>. // #import "IDEActivityReporter.h" @class DVTNotificationToken, IDEActivityReport; @interface IBSourceCodeScanningActivityReporter : IDEActivityReporter { DVTNotificationToken *_didUpdateParsingToken; IDEActivityReport *_workspaceActivityReport; } + (void)initialize; - (void).cxx_destruct; - (void)updateActivityReport:(id)arg1; - (void)primitiveInvalidate; - (id)initWithWorkspace:(id)arg1; @end
kineticsquid/kineticsquid
Jena/src/com/hp/hpl/jena/sparql/util/DatasetUtils.java
/* * 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 com.hp.hpl.jena.sparql.util; import java.util.ArrayList ; import java.util.Iterator ; import java.util.List ; import com.hp.hpl.jena.graph.Node ; import com.hp.hpl.jena.n3.IRIResolver ; import com.hp.hpl.jena.query.Dataset ; import com.hp.hpl.jena.query.DatasetFactory ; import com.hp.hpl.jena.rdf.model.Model ; import com.hp.hpl.jena.sparql.core.DatasetDescription ; import com.hp.hpl.jena.sparql.core.DatasetGraph ; import com.hp.hpl.jena.sparql.core.DatasetGraphFactory ; import com.hp.hpl.jena.sparql.graph.GraphFactory ; import com.hp.hpl.jena.util.FileManager ; /** Internal Dataset/DataSource factory + graph equivalents. */ public class DatasetUtils { public static Dataset createDataset(String uri, List<String> namedSourceList) { return createDataset(uri, namedSourceList, null, null) ; } public static Dataset createDataset(String uri, List<String> namedSourceList, FileManager fileManager, String baseURI) { List<String> uriList = new ArrayList<String>() ; uriList.add(uri) ; return createDataset(uriList, namedSourceList, fileManager, baseURI) ; } public static Dataset createDataset(List<String> uriList, List<String> namedSourceList) { return createDataset(uriList, namedSourceList, null, null) ; } public static Dataset createDataset(List<String> uriList, List<String> namedSourceList, FileManager fileManager, String baseURI) { // Fixed dataset - any GRAPH <notThere> in a query must return no match. Dataset ds = DatasetFactory.createMemFixed() ; addInGraphs(ds, uriList, namedSourceList, fileManager, baseURI) ; return ds ; } public static Dataset createDataset(DatasetDescription datasetDesc) { return createDataset(datasetDesc.getDefaultGraphURIs(), datasetDesc.getNamedGraphURIs(), null, null) ; } public static Dataset createDataset(DatasetDescription datasetDesc, FileManager fileManager, String baseURI) { return createDataset(datasetDesc.getDefaultGraphURIs(), datasetDesc.getNamedGraphURIs(), fileManager, baseURI) ; } /** add graphs into an exiting DataSource */ public static Dataset addInGraphs(Dataset ds, List<String> uriList, List<String> namedSourceList) { return addInGraphs(ds, uriList, namedSourceList, null, null) ; } /** add graphs into an existing DataSource */ public static Dataset addInGraphs(Dataset ds, List<String> uriList, List<String> namedSourceList, FileManager fileManager, String baseURI) { if ( fileManager == null ) fileManager = FileManager.get() ; if ( ds.getDefaultModel() == null ) // Merge into background graph ds.setDefaultModel(GraphFactory.makeDefaultModel()) ; if ( uriList != null ) { for (Iterator<String> iter = uriList.iterator() ; iter.hasNext() ; ) { String sourceURI = iter.next() ; String absURI = null ; if ( baseURI != null ) absURI = IRIResolver.resolve(sourceURI, baseURI) ; else absURI = IRIResolver.resolveGlobal(sourceURI) ; fileManager.readModel(ds.getDefaultModel(), sourceURI, absURI, null) ; } } if ( namedSourceList != null ) { for (Iterator<String> iter = namedSourceList.iterator() ; iter.hasNext() ; ) { String sourceURI = iter.next() ; String absURI = null ; if ( baseURI != null ) absURI = IRIResolver.resolve(sourceURI, baseURI) ; else absURI = IRIResolver.resolveGlobal(sourceURI) ; Model m = GraphFactory.makeDefaultModel() ; fileManager.readModel(m, sourceURI, absURI, null) ; ds.addNamedModel(absURI, m) ; } } return ds ; } // ---- DatasetGraph level. public static DatasetGraph createDatasetGraph(DatasetDescription datasetDesc) { return createDatasetGraph(datasetDesc.getDefaultGraphURIs(), datasetDesc.getNamedGraphURIs(), null, null) ; } public static DatasetGraph createDatasetGraph(DatasetDescription datasetDesc, FileManager fileManager, String baseURI) { return createDatasetGraph(datasetDesc.getDefaultGraphURIs(), datasetDesc.getNamedGraphURIs(), fileManager, baseURI) ; } public static DatasetGraph createDatasetGraph(String uri, List<String> namedSourceList, FileManager fileManager, String baseURI) { List<String> uriList = new ArrayList<String>() ; uriList.add(uri) ; return createDatasetGraph(uriList, namedSourceList, fileManager, baseURI) ; } public static DatasetGraph createDatasetGraph(List<String> uriList, List<String> namedSourceList, FileManager fileManager, String baseURI) { DatasetGraph ds = DatasetGraphFactory.createMem() ; if ( fileManager == null ) fileManager = FileManager.get() ; // Merge into background graph if ( uriList != null ) { Model m = GraphFactory.makeDefaultModel() ; for (Iterator<String> iter = uriList.iterator() ; iter.hasNext() ; ) { String sourceURI = iter.next() ; String absURI = null ; if ( baseURI != null ) absURI = IRIResolver.resolve(sourceURI, baseURI) ; else absURI = IRIResolver.resolveGlobal(sourceURI) ; // FileManager.readGraph? fileManager.readModel(m, sourceURI, absURI, null) ; } ds.setDefaultGraph(m.getGraph()) ; } else { ds.setDefaultGraph(GraphFactory.createDefaultGraph()) ; } if ( namedSourceList != null ) { for (Iterator<String> iter = namedSourceList.iterator() ; iter.hasNext() ; ) { String sourceURI = iter.next(); String absURI = null ; if ( baseURI != null ) absURI = IRIResolver.resolve(baseURI, sourceURI) ; else absURI = IRIResolver.resolveGlobal(sourceURI) ; Model m = fileManager.loadModel(sourceURI, absURI, null) ; Node gn = Node.createURI(sourceURI) ; ds.addGraph(gn, m.getGraph()) ; } } return ds ; } // private static Node nodeOrStr(Object obj) // { // if ( obj instanceof Node) return (Node)obj ; // if ( obj instanceof String) return Node.createURI((String)obj) ; // throw new DataException("Not a string nor a Node: ("+Utils.className(obj)+") "+obj) ; // } }
cvisionai/tator-py
test/test_attachment.py
<reponame>cvisionai/tator-py import tempfile import os import tator def test_attachment(host, token, project, video): tator_api = tator.get_api(host, token) with tempfile.NamedTemporaryFile(mode='w',suffix=".txt") as temp: temp.write("foo") temp.flush() for progress, response in tator.util.upload_attachment(tator_api, video, temp.name): print(f"Attachment upload progress: {progress}%") assert isinstance(response, tator.models.MessageResponse) print(f"Message: {response.message}") with tempfile.TemporaryDirectory() as temp_dir: temp_fp = os.path.join(temp_dir, "foo.txt") media_obj = tator_api.get_media(video) for progress in tator.util.download_attachment(tator_api, media_obj, temp_fp): print(f"Attachment download progress: {progress}%") with open(temp_fp, 'r') as temp_file: contents = temp_file.read() assert contents == "foo"
pousse-cafe/pousse-cafe-source
src/main/java/poussecafe/source/generation/ProducesEventsEditor.java
package poussecafe.source.generation; import java.util.ArrayList; import java.util.Collection; import java.util.List; import java.util.Optional; import org.eclipse.jdt.core.dom.Annotation; import org.eclipse.jdt.core.dom.Expression; import org.eclipse.jdt.core.dom.MemberValuePair; import org.eclipse.jdt.core.dom.NormalAnnotation; import org.eclipse.jdt.core.dom.SimpleType; import org.eclipse.jdt.core.dom.SingleMemberAnnotation; import org.eclipse.jdt.core.dom.TypeLiteral; import poussecafe.discovery.ProducesEvent; import poussecafe.source.analysis.ClassName; import poussecafe.source.generation.tools.AstWrapper; import poussecafe.source.generation.tools.MethodDeclarationEditor; import poussecafe.source.generation.tools.ModifiersEditor; import poussecafe.source.generation.tools.NormalAnnotationEditor; import poussecafe.source.generation.tools.SingleMemberAnnotationEditor; import poussecafe.source.model.ProducedEvent; import static java.util.Objects.requireNonNull; public class ProducesEventsEditor { public void edit() { for(ProducedEvent producedEvent : producedEvents) { editProducesEventAnnotation(methodEditor, producedEvent); } } private List<ProducedEvent> producedEvents = new ArrayList<>(); private MethodDeclarationEditor methodEditor; private void editProducesEventAnnotation(MethodDeclarationEditor editor, ProducedEvent producedEvent) { Optional<Annotation> producedEventAnnotation = findAnnotationMatching(editor, producedEvent.message().name()); var modifiers = editor.modifiers(); if(producedEventAnnotation.isEmpty()) { addProducesEventAnnotation(modifiers, producedEvent); } else if(!annotationMatches(producedEventAnnotation.get(), producedEvent)) { modifiers.removeAnnotation(producedEventAnnotation.get()); addProducesEventAnnotation(modifiers, producedEvent); } else { editProducesEventAnnotation(modifiers, producedEventAnnotation.get(), producedEvent); } } private Optional<Annotation> findAnnotationMatching(MethodDeclarationEditor methodEditor, String eventName) { var producesEventAnnotations = methodEditor.modifiers().findAnnotations(ProducesEvent.class); for(Annotation annotation : producesEventAnnotations) { if(annotationMatches(eventName, annotation)) { return Optional.of(annotation); } } return Optional.empty(); } private boolean annotationMatches(String eventName, Annotation annotation) { return (annotation.isSingleMemberAnnotation() && singleMemberAnnotationMatches((SingleMemberAnnotation) annotation, eventName)) || (annotation.isNormalAnnotation() && normalAnnotationMatches((NormalAnnotation) annotation, eventName)); } private boolean singleMemberAnnotationMatches(SingleMemberAnnotation annotation, String eventName) { var value = annotation.getValue(); return annotationValueIsSimpleType(eventName, value); } private boolean annotationValueIsSimpleType(String eventName, Expression value) { if(value instanceof TypeLiteral) { TypeLiteral literal = (TypeLiteral) value; if(literal.getType() instanceof SimpleType) { var simpleType = (SimpleType) literal.getType(); return simpleType.getName().getFullyQualifiedName().equals(eventName); } else { return false; } } else { return false; } } private boolean normalAnnotationMatches(NormalAnnotation annotation, String eventName) { var value = findNormalAnnotationValue(annotation, "value"); return value.isPresent() && annotationValueIsSimpleType(eventName, value.get()); } private Optional<Expression> findNormalAnnotationValue(NormalAnnotation annotation, String attributeName) { for(Object valuePairObject : annotation.values()) { MemberValuePair valuePair = (MemberValuePair) valuePairObject; if(valuePair.getName().getIdentifier().equals(attributeName)) { return Optional.of(valuePair.getValue()); } } return Optional.empty(); } private void addProducesEventAnnotation(ModifiersEditor modifiers, ProducedEvent producedEvent) { if(producedEvent.required() && producedEvent.consumedByExternal().isEmpty()) { addProducesEventSingleMemberAnnotation(modifiers, producedEvent); } else { addProducesEventNormalAnnotation(modifiers, producedEvent); } } private void addProducesEventSingleMemberAnnotation(ModifiersEditor modifiers, ProducedEvent producedEvent) { var annotationEditor = modifiers.insertNewSingleMemberAnnotationLast(new ClassName(ProducesEvent.class.getCanonicalName())); setSingleValue(producedEvent, annotationEditor); } private void setSingleValue(ProducedEvent producedEvent, SingleMemberAnnotationEditor annotationEditor) { annotationEditor.setValue(ast.newTypeLiteral(new ClassName(producedEvent.message().name()))); } private AstWrapper ast; private void addProducesEventNormalAnnotation(ModifiersEditor modifiers, ProducedEvent producedEvent) { var annotationEditor = modifiers.insertNewNormalAnnotationLast(new ClassName(ProducesEvent.class.getCanonicalName())); setAttributes(producedEvent, annotationEditor); } private void setAttributes(ProducedEvent producedEvent, NormalAnnotationEditor annotationEditor) { annotationEditor.setAttribute("value", ast.newTypeLiteral(new ClassName(producedEvent.message().name()))); if(!producedEvent.required()) { annotationEditor.setAttribute("required", ast.ast().newBooleanLiteral(false)); } if(producedEvent.consumedByExternal().size() == 1) { annotationEditor.setAttribute("consumedByExternal", ast.newStringLiteral(producedEvent.consumedByExternal().get(0))); } else if(producedEvent.consumedByExternal().size() > 1) { annotationEditor.setAttribute("consumedByExternal", ast.newStringArrayInitializer(producedEvent.consumedByExternal())); } } private boolean annotationMatches(Annotation annotation, ProducedEvent producedEvent) { if(producedEvent.required() && producedEvent.consumedByExternal().isEmpty()) { return annotation.isSingleMemberAnnotation(); } else { return annotation.isNormalAnnotation(); } } private void editProducesEventAnnotation(ModifiersEditor modifiers, Annotation annotation, ProducedEvent producedEvent) { if(producedEvent.required() && producedEvent.consumedByExternal().isEmpty()) { editSingleMemberAnnotation(modifiers, annotation, producedEvent); } else { editNormalAnnotation(modifiers, annotation, producedEvent); } } private void editSingleMemberAnnotation(ModifiersEditor modifiers, Annotation annotation, ProducedEvent producedEvent) { var editor = modifiers.singleMemberAnnotationEditor(annotation); setSingleValue(producedEvent, editor); } private void editNormalAnnotation(ModifiersEditor modifiers, Annotation annotation, ProducedEvent producedEvent) { var editor = modifiers.normalAnnotationEditor(annotation); setAttributes(producedEvent, editor); } public static class Builder { private ProducesEventsEditor editor = new ProducesEventsEditor(); public ProducesEventsEditor build() { requireNonNull(editor.methodEditor); editor.ast = editor.methodEditor.ast(); return editor; } public Builder methodEditor(MethodDeclarationEditor methodEditor) { editor.methodEditor = methodEditor; return this; } public Builder producedEvents(Collection<ProducedEvent> producedEvents) { editor.producedEvents.addAll(producedEvents); return this; } } private ProducesEventsEditor() { } }
pengchujin/LeetCode-Go
leetcode/9990975.Odd-Even-Jump/975. Odd Even Jump.go
<filename>leetcode/9990975.Odd-Even-Jump/975. Odd Even Jump.go package leetcode import ( "fmt" ) func oddEvenJumps(A []int) int { oddJumpMap, evenJumpMap, count, current, res := map[int]int{}, map[int]int{}, 1, 0, 0 for i := 0; i < len(A); i++ { for j := i + 1; j < len(A); j++ { if v, ok := oddJumpMap[i]; ok { if A[i] <= A[j] && A[j] <= A[v] { if A[j] == A[v] && j < oddJumpMap[i] { oddJumpMap[i] = j } else if A[j] < A[v] { oddJumpMap[i] = j } } } else { if A[i] <= A[j] { oddJumpMap[i] = j } } } } for i := 0; i < len(A); i++ { for j := i + 1; j < len(A); j++ { if v, ok := evenJumpMap[i]; ok { if A[i] >= A[j] && A[j] >= A[v] { if A[j] == A[v] && j < evenJumpMap[i] { evenJumpMap[i] = j } else if A[j] > A[v] { evenJumpMap[i] = j } } } else { if A[i] >= A[j] { evenJumpMap[i] = j } } } } fmt.Printf("oddJumpMap = %v evenJumpMap = %v\n", oddJumpMap, evenJumpMap) for i := 0; i < len(A); i++ { count, current = 1, i for { if count%2 == 1 { if v, ok := oddJumpMap[current]; ok { if v == len(A)-1 { res++ break } current = v count++ } else { break } } if count%2 == 0 { if v, ok := evenJumpMap[current]; ok { if v == len(A)-1 { res++ break } current = v count++ } else { break } } } } return res + 1 }
opencomputeproject/Rack-Manager
Contrib-Microsoft/Olympus_rack_manager/ocs/Init/ocs-init.c
// Copyright (C) Microsoft Corporation. All rights reserved. // // This program is free software; you can redistribute it // and/or modify it under the terms of the GNU General Public License // as published by the Free Software Foundation; either version 2 // of the License, or (at your option) any later version. #include <stdio.h> #include <stdlib.h> #include <sys/types.h> #include <unistd.h> #include <syslog.h> #include <errno.h> #include <string.h> #include "ocslog-shm.h" #include "ocslock.h" #include "ocsfile.h" int main() { int ocslock_id, ret; int fail = 0; for(ocslock_id=0; ocslock_id<NUM_OCSLOCKS; ocslock_id++) { ret = ocslock_init(ocslock_id); if(ret!=0) { syslog(LOG_ERR, "Ocs-Init for ocslockid %d failed with error code %d\n", ocslock_id, ret); fail = 1; } } ret = shm_create (); if(ret!=0) { syslog(LOG_ERR, "Ocs-Init failed to create log shared memory: %d\n", ret); fail = 1; } ret = ocs_file_validate_all (); if (ret != 0) { syslog (LOG_ERR, "Ocs-Init failed to verify all system files: %d\n", ret); fail = 1; } ret = daemon (0, 0); if (ret == 0) { /* Daemon loop to re-validate files on-demand after they have been written. */ while (1) { int retry = 0; ocs_lock (OCSFILE_WRITE); if (ocs_condwait (OCSFILE_WRITE) == 0) { ocs_unlock (OCSFILE_WRITE); } while ((ocs_file_validate_all () != 0) && (retry < 6)) { syslog (LOG_ERR, "Ocs-Init validation failed, retry (%d).\n", retry); sleep (10); retry++; } } } else { syslog (LOG_ERR, "Ocs-Init failed to start file integrity daemon: %s\n", strerror (errno)); fail = 1; } return fail; }
jurgendl/jhaws
jhaws/elasticsearch-impl/src/main/java/org/jhaws/common/elasticsearch/impl/ElasticCustomizer.java
package org.jhaws.common.elasticsearch.impl; import java.lang.reflect.Modifier; import java.util.Arrays; import java.util.Collection; import java.util.LinkedHashMap; import java.util.List; import java.util.Map; import java.util.Optional; import java.util.TreeMap; import org.apache.commons.lang3.StringUtils; import org.jhaws.common.elasticsearch.common.Analyzer; import org.jhaws.common.elasticsearch.common.Analyzers; import org.jhaws.common.elasticsearch.common.Bool; import org.jhaws.common.elasticsearch.common.CharacterFilter; import org.jhaws.common.elasticsearch.common.Field; import org.jhaws.common.elasticsearch.common.FieldExtra; import org.jhaws.common.elasticsearch.common.FieldType; import org.jhaws.common.elasticsearch.common.Filter; import org.jhaws.common.elasticsearch.common.Ignore; import org.jhaws.common.elasticsearch.common.Language; import org.jhaws.common.elasticsearch.common.NestedField; import org.jhaws.common.elasticsearch.common.OnlySave; import org.jhaws.common.elasticsearch.common.Stemmer; import org.jhaws.common.elasticsearch.common.Tokenizer; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.annotation.JsonUnwrapped; //@Component public class ElasticCustomizer { protected final Logger LOGGER = LoggerFactory.getLogger(ElasticCustomizer.class); /** * needs cluster restart!<br> * client.updateClusterSetting(config -> * config.put(ElasticCustomizer.CLUSER_SETTING_SEARCH_MAX_BUCKETS, * ElasticCustomizer.CLUSER_SETTING_SEARCH_MAX_BUCKETS_VALUE)); */ public static final String CLUSER_SETTING_SEARCH_MAX_BUCKETS = "search.max_buckets"; /** * client.updateIndexSetting(${index}, config -> * config.put(ElasticCustomizer.INDEX_SETTINGS_MAX_RESULTS, * ElasticCustomizer.INDEX_SETTINGS_MAX_RESULTS_VALUE)); */ public static final String INDEX_SETTINGS_MAX_RESULTS = "max_result_window"; public static final String INDEX_SETTINGS_HIGHLIGHT_MAX_ANALYZED_OFFSET = "highlight.max_analyzed_offset"; private static final String CUSTOM = "custom"; private static final String REPLACEMENT = "replacement"; private static final String PATTERN = "pattern"; private static final String ENABLED = "enabled"; private static final String INDEX = "index"; private static final String LANGUAGE = "language"; private static final String STOPWORDS = "stopwords"; private static final String FIELDDATA = "fielddata"; private static final String STORE = "store"; private static final String FIELDS = "fields"; private static final String PROPERTIES = "properties"; private static final String MAX = "max"; private static final String MIN = "min"; private static final String PATTERNS = "patterns"; private static final String PRESERVE_ORIGINAL = "preserve_original"; private static final String TYPE = "type"; private static final String FILTER = "filter"; private static final String ANALYZER = "analyzer"; private static final String ANALYSIS = "analysis"; private static final String CHAR_FILTER = "char_filter"; private static final String TOKENIZER = "tokenizer"; private static final String ARTICLES = "articles"; private static final String ARTICLES_CASE = "articles_case"; public Map<String, Object> settings() { // "mappings": { // "_source": { // "enabled": false // } // } Map<String, Object> analysis = new LinkedHashMap<>(); Map<String, Object> filter = new LinkedHashMap<>(); filter.put(Filters.CUSTOM_LENGTH_3_TO_20_CHAR_LENGTH_FILTER, customCleanupFilter()); filter.put(Filters.CUSTOM_EMAIL_NAME_FILTER, customEmailNameFilter()); filter.put(Filters.CUSTOM_EMAIL_DOMAIN_FILTER, customEmailDomainFilter()); filter.put(Filters.ENGLISH_STOP, customEnglishStopFilter()); filter.put(Filters.ENGLISH_STEMMER, customEnglishStemmerFilter()); filter.put(Filters.ENGLISH_POSSESSIVE_STEMMER, customEnglishPossessiveStemmerFilter()); filter.put(Filters.DUTCH_STOP, customDutchStopFilter()); filter.put(Filters.DUTCH_STEMMER, customDutchStemmerFilter()); filter.put(Filters.CUSTOM_TO_SPACE_FILTER, customToSpaceFilter()); filter.put(Filters.CUSTOM_REMOVE_SPACE_FILTER, customRemoveSpaceFilter()); filter.put(Filters.CUSTOM_ONLY_KEEP_ALPHA_FILTER, customOnlyKeepAlphaFilter()); filter.put(Filters.CUSTOM_ONLY_KEEP_ALPHANUMERIC_FILTER, customOnlyKeepAlphaNumericFilter()); filter.put(Filters.CUSTOM_FRENCH_ELISION_FILTER, customFrenchElisionFilter()); filter.put(Filters.CUSTOM_FRENCH_STOP_FILTER, customFrenchStopFilter()); filter.put(Filters.CUSTOM_FRENCH_STEMMER_FILTER, customFrenchStemmerFilter()); analysis.put(FILTER, filter); Map<String, Object> tokenizer = new LinkedHashMap<>(); // tokenizer.put(Tokenizers.CUSTOM_PUNCTUATION_TOKENIZER, // customPunctuationTokenizer()); // tokenizer.put(Tokenizers.CUSTOM_FILENAME_TOKENIZER, // customFilenameTokenizer()); analysis.put(TOKENIZER, tokenizer); Map<String, Object> analyzer = new LinkedHashMap<>(); analyzer.put(Analyzers.CUSTOM_CLEANUP_ANALYZER, customCleanupAnalyzer()); analyzer.put(Analyzers.CUSTOM_DUTCH_HTML_ANALYZER, customDutchHtmlAnalyzer()); analyzer.put(Analyzers.CUSTOM_ENGLISH_HTML_ANALYZER, customEnglishHtmlAnalyzer()); analyzer.put(Analyzers.CUSTOM_ASCIIFOLDING_ANALYZER, customAsciiFoldingAnalyzer()); analyzer.put(Analyzers.CUSTOM_EMAIL_NAME_ANALYZER, customEmailNameAnalyzer()); analyzer.put(Analyzers.CUSTOM_EMAIL_NAME_KEEP_TOGETHER_ANALYZER, customEmailNameKeepTogetherAnalyzer()); analyzer.put(Analyzers.CUSTOM_EMAIL_DOMAIN_ANALYZER, customEmailDomainAnalyzer()); analyzer.put(Analyzers.CUSTOM_EMAIL_ANALYZER, customEmailAnalyzer()); analyzer.put(Analyzers.CUSTOM_FILENAME_ANALYZER, customFilenameAnalyzer()); analyzer.put(Analyzers.CUSTOM_WORD_DELIMITER_GRAPH_ANALYZER, customWordDelimiterGraphAnalyzer()); analyzer.put(Analyzers.CUSTOM_WHITESPACE_LOWERCASE_ANALYZER, customWhitespaceAnalyzer()); analyzer.put(Analyzers.CUSTOM_NAME_KEEP_TOGETHER_ANALYZER, customNameKeepTogetherAnalyzer()); analyzer.put(Analyzers.CUSTOM_SORTABLE_ANALYZER, customSortableAnalyzer()); analyzer.put(Analyzers.CUSTOM_SORTABLE_ONLY_ALPHA_ANALYZER, customSortableOnlyAlphaAnalyzer()); analyzer.put(Analyzers.CUSTOM_SORTABLE_ONLY_ALPHANUMERIC_ANALYZER, customSortableOnlyAlphaNumericAnalyzer()); analyzer.put(Analyzers.CUSTOM_ANY_LANGUAGE_ANALYZER, customAnyLanguageAnalyzer()); analyzer.put(Analyzers.CUSTOM_FRENCH_LANGUAGE_ANALYZER, customFrenchLanguageAnalyzer()); analysis.put(ANALYZER, analyzer); Map<String, Object> settings = new LinkedHashMap<>(); settings.put(ANALYSIS, analysis); { Map<String, Object> indexSettings = new LinkedHashMap<>(); indexSettings.put(INDEX_SETTINGS_HIGHLIGHT_MAX_ANALYZED_OFFSET, highlightMaxAnalyzedOffset); settings.put(INDEX, indexSettings); } { settings.put(INDEX_SETTINGS_MAX_RESULTS, maxResultWindow); } return settings; } public Map<String, Object> customEnglishHtmlAnalyzer() { // https://www.elastic.co/guide/en/elasticsearch/reference/current/analysis-htmlstrip-charfilter.html // standardTokenizer: // https://www.elastic.co/guide/en/elasticsearch/reference/current/analysis-tokenizers.html Map<String, Object> analyzerConfig = new LinkedHashMap<>(); analyzerConfig.put(TYPE, CUSTOM); analyzerConfig.put(TOKENIZER, Tokenizer.standard.id()); analyzerConfig.put(CHAR_FILTER, Arrays.asList(CharacterFilter.html_strip.id())); analyzerConfig.put(FILTER, Arrays.asList(Filters.ENGLISH_POSSESSIVE_STEMMER, Filter.lowercase.id(), Filters.ENGLISH_STOP, Filters.ENGLISH_STEMMER)); return analyzerConfig; } public Map<String, Object> customDutchHtmlAnalyzer() { Map<String, Object> analyzerConfig = new LinkedHashMap<>(); analyzerConfig.put(TYPE, CUSTOM); analyzerConfig.put(TOKENIZER, Tokenizer.standard.id()); analyzerConfig.put(CHAR_FILTER, Arrays.asList(CharacterFilter.html_strip.id())); analyzerConfig.put(FILTER, Arrays.asList(Filter.lowercase.id(), Filters.DUTCH_STOP, Filters.DUTCH_STEMMER)); return analyzerConfig; } public Map<String, Object> customAsciiFoldingAnalyzer() { // https: // // www.elastic.co/guide/en/elasticsearch/reference/current/analysis-asciifolding-tokenfilter.html Map<String, Object> analyzerConfig = new LinkedHashMap<>(); analyzerConfig.put(TYPE, CUSTOM); analyzerConfig.put(TOKENIZER, Tokenizer.standard.id()); analyzerConfig.put(FILTER, Arrays.asList(Filter.asciifolding.id())); return analyzerConfig; } public Map<String, Object> customCleanupFilter() { Map<String, Object> filterConfig = new LinkedHashMap<>(); filterConfig.put(TYPE, Filter.length.id()); filterConfig.put(MIN, 3); filterConfig.put(MAX, 20); return filterConfig; } public Map<String, Object> customCleanupAnalyzer() { Map<String, Object> analyzerConfig = new LinkedHashMap<>(); analyzerConfig.put(TYPE, CUSTOM); analyzerConfig.put(TOKENIZER, Tokenizer.standard.id()); analyzerConfig.put(FILTER, Arrays.asList(// Filter.trim.id()// , Filter.asciifolding.id()// , Filter.lowercase.id()// , Filter.word_delimiter.id()// , Filters.CUSTOM_LENGTH_3_TO_20_CHAR_LENGTH_FILTER// )); return analyzerConfig; } public Map<String, Object> customEnglishPossessiveStemmerFilter() { Map<String, Object> filterConfig = new LinkedHashMap<>(); filterConfig.put(TYPE, Filter.stemmer.id()); filterConfig.put(LANGUAGE, "possessive_" + Language.english.id()); return filterConfig; } public Map<String, Object> customDutchStemmerFilter() { return customStemmerFilter(Stemmer.dutch); } public Map<String, Object> customEnglishStemmerFilter() { return customStemmerFilter(Stemmer.english); } public Map<String, Object> customFrenchStemmerFilter() { return customStemmerFilter(Stemmer.french); } public Map<String, Object> customDutchStopFilter() { return customStopFilter(Language.dutch); } public Map<String, Object> customEnglishStopFilter() { return customStopFilter(Language.english); } public Map<String, Object> customFrenchStopFilter() { return customStopFilter(Language.french); } public Map<String, Object> customEmailAnalyzer() { Map<String, Object> analyzerConfig = new LinkedHashMap<>(); analyzerConfig.put(TYPE, CUSTOM); analyzerConfig.put(TOKENIZER, Tokenizer.uax_url_email.id()); return analyzerConfig; } public Map<String, Object> customEmailDomainAnalyzer() { Map<String, Object> analyzerConfig = new LinkedHashMap<>(); analyzerConfig.put(TYPE, CUSTOM); analyzerConfig.put(TOKENIZER, Tokenizer.uax_url_email.id()); analyzerConfig.put(FILTER, Arrays.asList(// Filters.CUSTOM_EMAIL_DOMAIN_FILTER// , Filter.lowercase.id()// )); return analyzerConfig; } public Map<String, Object> customEmailNameAnalyzer() { Map<String, Object> analyzerConfig = new LinkedHashMap<>(); analyzerConfig.put(TYPE, CUSTOM); analyzerConfig.put(TOKENIZER, Tokenizer.uax_url_email.id()); analyzerConfig.put(FILTER, Arrays.asList(// Filters.CUSTOM_EMAIL_NAME_FILTER// , Filter.lowercase.id()// , Filter.word_delimiter.id()// , Filter.unique.id()// )); return analyzerConfig; } public Map<String, Object> customEmailNameKeepTogetherAnalyzer() { Map<String, Object> analyzerConfig = new LinkedHashMap<>(); analyzerConfig.put(TYPE, CUSTOM); analyzerConfig.put(TOKENIZER, Tokenizer.uax_url_email.id()); analyzerConfig.put(FILTER, Arrays.asList(// Filters.CUSTOM_EMAIL_NAME_FILTER// , Filter.lowercase.id()// )); return analyzerConfig; } public Map<String, Object> customEmailDomainFilter() { Map<String, Object> filterConfig = new LinkedHashMap<>(); filterConfig.put(TYPE, Filter.pattern_capture.id()); filterConfig.put(PRESERVE_ORIGINAL, false); filterConfig.put(PATTERNS, Arrays.asList("@(.+)")); return filterConfig; } public Map<String, Object> customEmailNameFilter() { Map<String, Object> filterConfig = new LinkedHashMap<>(); filterConfig.put(TYPE, Filter.pattern_capture.id()); filterConfig.put(PRESERVE_ORIGINAL, false); filterConfig.put(PATTERNS, Arrays.asList("(.+)@")); return filterConfig; } public Map<String, Object> customStemmerFilter(Stemmer language) { Map<String, Object> filterConfig = new LinkedHashMap<>(); filterConfig.put(TYPE, Filter.stemmer.id()); filterConfig.put(LANGUAGE, language.id()); return filterConfig; } public Map<String, Object> customStopFilter(Language language) { Map<String, Object> filterConfig = new LinkedHashMap<>(); filterConfig.put(TYPE, Filter.stop.id()); filterConfig.put(STOPWORDS, "_" + language.id() + "_"); return filterConfig; } public Map<String, Object> getObjectMapping(Class<?> annotatedType, MappingListener listener) { Map<String, Object> typeMapping = new TreeMap<>(); $mappings_fields(null, annotatedType, typeMapping, "", listener); Map<String, Object> mappings = new TreeMap<>(); mappings.put(PROPERTIES, typeMapping); return mappings; } protected void $mappings_fields(Language language, Class<?> annotatedType, Map<String, Object> typeMapping, String prefix, MappingListener listener) { Arrays.stream(annotatedType.getDeclaredFields())// .filter(f -> !Modifier.isTransient(f.getModifiers()))// .filter(f -> !Modifier.isStatic(f.getModifiers()))// .filter(f -> f.getAnnotation(JsonIgnore.class) == null)// .filter(f -> f.getAnnotation(Ignore.class) == null)// .forEach(field -> $mappings_field(language, typeMapping, prefix, field, listener)); } protected void $mappings_field(Language language, Map<String, Object> mapping, String prefix, java.lang.reflect.Field reflectField, MappingListener listener) { OnlySave onlySave = reflectField.getAnnotation(OnlySave.class); if (onlySave != null) { // https://www.elastic.co/guide/en/elasticsearch/reference/current/enabled.html String fullName = prefix + (StringUtils.isBlank(onlySave.name()) ? reflectField.getName() : onlySave.name()); Map<String, Object> fieldMapping = new TreeMap<>(); fieldMapping.put(TYPE, FieldType.OBJECT.id()); fieldMapping.put(ENABLED, Boolean.FALSE); mapping.put(fullName, fieldMapping); } else { Field field = reflectField.getAnnotation(Field.class); if (field != null) { FieldType defaultFieldType = $defaultFieldType(reflectField); FieldMapping fieldMapping = $mappings_field(language, defaultFieldType, field); String fullName = prefix + (StringUtils.isBlank(field.name()) ? reflectField.getName() : field.name()); mapping.put(fullName, fieldMapping.fieldMapping); if (listener != null) listener.map(fullName, field, fieldMapping); if (reflectField.getAnnotation(FieldExtra.class) != null) { Field[] fef = reflectField.getAnnotation(FieldExtra.class).value(); if (fef != null && fef.length > 0) { Map<String, Object> extraFields = new TreeMap<>(); fieldMapping.put(FIELDS, extraFields); Arrays.stream(fef).forEach(nestedField -> { extraFields.put(nestedField.name(), $mappings_field(fieldMapping.language, fieldMapping.fieldType, nestedField).fieldMapping); if (listener != null) listener.map(fullName + "." + nestedField.name(), nestedField, fieldMapping); }); } } } else { JsonUnwrapped nested = reflectField.getAnnotation(JsonUnwrapped.class); if (nested != null) { if (StringUtils.isNotBlank(nested.suffix())) { throw new IllegalArgumentException("suffix nog niet ondersteund"); } String nestedPrefix = nested.prefix(); if (StringUtils.isBlank(nestedPrefix)) { throw new IllegalArgumentException("prefix verplicht"); } NestedField nestedField = reflectField.getAnnotation(NestedField.class); if (nestedField != null && nestedField.language() != null && nestedField.language() != Language.uninitialized) { $mappings_fields(nestedField.language(), reflectField.getType(), mapping, prefix + nestedPrefix, listener); } else { $mappings_fields(language, reflectField.getType(), mapping, prefix + nestedPrefix, listener); } } else { Map<String, Object> typeMapping = new TreeMap<>(); NestedField nestedField = reflectField.getAnnotation(NestedField.class); if (nestedField != null && nestedField.language() != null && nestedField.language() != Language.uninitialized) { $mappings_fields(nestedField.language(), reflectField.getType(), typeMapping, "", listener); } else { $mappings_fields(language, reflectField.getType(), typeMapping, "", listener); } Map<String, Object> mappings = new TreeMap<>(); mappings.put(PROPERTIES, typeMapping); mapping.put(reflectField.getName(), mappings); } } } } protected FieldMapping $mappings_field(Language language, FieldType fieldType, Field field) { FieldMapping fieldMapping = new FieldMapping(); fieldMapping.language = field.language() == null || field.language() == Language.uninitialized ? language : field.language(); fieldMapping.fieldType = field.type() == null || field.type() == FieldType.uninitialized ? fieldType : field.type(); fieldMapping.put(TYPE, fieldMapping.fieldType.id()); fieldMapping.fieldType.options().entrySet() .forEach(option -> fieldMapping.fieldMapping.put(option.getKey(), option.getValue())); if (StringUtils.isNotBlank(field.customAnalyzer())) { if (fieldMapping.fieldType != FieldType.TEXT// && fieldMapping.fieldType != FieldType.TEXT_VECTOR// && fieldMapping.fieldType != FieldType.TEXT_VECTOR_PAYLOADS// && fieldMapping.fieldType != FieldType.TEXT_VECTOR_POSITIONS// && fieldMapping.fieldType != FieldType.TEXT_VECTOR_POSITIONS_OFFSETS// && fieldMapping.fieldType != FieldType.TEXT_VECTOR_POSITIONS_OFFSETS_PAYLOADS// ) { LOGGER.warn("custom analyzer on non text-field"); } if (fieldMapping.language == null) { fieldMapping.put(ANALYZER, replaceAnalyze(field.customAnalyzer())); } else { fieldMapping.put(ANALYZER, replaceAnalyze( field.customAnalyzer().replace(Analyzers.LANGUAGE_PARAMETER, fieldMapping.language.id()))); } } else if (field.analyzer() != null && field.analyzer() != Analyzer.uninitialized) { fieldMapping.put(ANALYZER, replaceAnalyze(field.analyzer().id(fieldMapping.language))); // } else { // fieldMapping.put(ANALYZER, Analyzer.standard.id(null)); } if (field.store() != null && field.store() != Bool.uninitialized) { fieldMapping.put(STORE, field.store().value()); } if (field.fielddata() != null && field.fielddata() != Bool.uninitialized) { fieldMapping.put(FIELDDATA, field.fielddata().value()); } return fieldMapping; } public FieldType $defaultFieldType(java.lang.reflect.Field field) { if (Collection.class.isAssignableFrom(field.getType())) { Class<?> collectionType = ElasticHelper.getCollectionType(field); if (collectionType == null) { return FieldType.TEXT; } return $defaultFieldType(collectionType); } return $defaultFieldType(field.getType()); } protected FieldType $defaultFieldType(Class<?> ft) { if (byte[].class.isAssignableFrom(ft)) { return FieldType.BYTES; } if (ft.isArray()) { return $defaultFieldType(ft.getComponentType()); } if (Short.class.isAssignableFrom(ft) || Short.TYPE.isAssignableFrom(ft)) { return FieldType.SHORT; } if (Integer.class.isAssignableFrom(ft) || Integer.TYPE.isAssignableFrom(ft)) { return FieldType.INT; } if (Long.class.isAssignableFrom(ft) || Long.TYPE.isAssignableFrom(ft)) { return FieldType.LONG; } if (Float.class.isAssignableFrom(ft) || Float.TYPE.isAssignableFrom(ft)) { return FieldType.FLOAT; } if (Double.class.isAssignableFrom(ft) || Double.TYPE.isAssignableFrom(ft)) { return FieldType.DOUBLE; } if (Boolean.class.isAssignableFrom(ft) || Boolean.TYPE.isAssignableFrom(ft)) { return FieldType.BOOL; } if (Byte.class.isAssignableFrom(ft) || Byte.TYPE.isAssignableFrom(ft)) { return FieldType.BYTE; } if (java.util.Date.class.isAssignableFrom(ft)) { return FieldType.DATE; } if (java.time.LocalDate.class.isAssignableFrom(ft)) { return FieldType.DATE; } if (java.time.LocalDateTime.class.isAssignableFrom(ft)) { return FieldType.DATE; } if (org.joda.time.LocalDate.class.isAssignableFrom(ft)) { return FieldType.DATE; } if (org.joda.time.LocalDateTime.class.isAssignableFrom(ft)) { return FieldType.DATE; } return FieldType.TEXT; } public Map<String, Object> customToSpaceFilter() { Map<String, Object> filterConfig = new LinkedHashMap<>(); filterConfig.put(TYPE, Filter.pattern_replace.id()); String pattern = "["// + ".,!?"// + "]"; filterConfig.put(PATTERN, pattern); filterConfig.put(REPLACEMENT, " "); return filterConfig; } // public Map<String, Object> customFilenameTokenizer() { // Map<String, Object> cfg = new LinkedHashMap<>(); // cfg.put(TYPE, PATTERN); // String pattern = "["// // + " "// // + ".,!?"// // + "_-"// // + "]"; // System.out.println(pattern); // cfg.put(PATTERN, pattern); // return cfg; // } // // public Map<String, Object> customPunctuationTokenizer() { // Map<String, Object> cfg = new LinkedHashMap<>(); // cfg.put(TYPE, PATTERN); // cfg.put(PATTERN, "["// // + " "// // + ".,!?"// // + "]"); // return cfg; // } public Map<String, Object> customWordDelimiterGraphAnalyzer() { Map<String, Object> analyzerConfig = new LinkedHashMap<>(); analyzerConfig.put(TYPE, CUSTOM); analyzerConfig.put(TOKENIZER, Tokenizer.keyword.id()); analyzerConfig.put(FILTER, Arrays.asList(Filter.word_delimiter_graph.id())); return analyzerConfig; } public Map<String, Object> customFilenameAnalyzer() { Map<String, Object> analyzerConfig = new LinkedHashMap<>(); analyzerConfig.put(TYPE, CUSTOM); analyzerConfig.put(TOKENIZER, Tokenizer.keyword.id()); analyzerConfig.put(FILTER, Arrays.asList(Filter.word_delimiter_graph.id(), Filter.asciifolding.id(), Filter.lowercase.id())); return analyzerConfig; } public Map<String, Object> customWhitespaceAnalyzer() { // https://www.elastic.co/guide/en/elasticsearch/reference/current/analysis-lowercase-tokenfilter.html Map<String, Object> analyzerConfig = new LinkedHashMap<>(); analyzerConfig.put(TYPE, CUSTOM); analyzerConfig.put(TOKENIZER, Tokenizer.whitespace.id()); analyzerConfig.put(FILTER, Filter.lowercase.id()); return analyzerConfig; } public Map<String, Object> customNameKeepTogetherAnalyzer() { Map<String, Object> analyzerConfig = new LinkedHashMap<>(); analyzerConfig.put(TYPE, CUSTOM); analyzerConfig.put(TOKENIZER, Tokenizer.keyword.id()); analyzerConfig.put(FILTER, Arrays.asList(Filter.asciifolding.id(), Filter.lowercase.id())); return analyzerConfig; } public Map<String, Object> customRemoveSpaceFilter() { Map<String, Object> filterConfig = new LinkedHashMap<>(); filterConfig.put(TYPE, Filter.pattern_replace.id()); String pattern = "["// + " "// + "]"; filterConfig.put(PATTERN, pattern); filterConfig.put(REPLACEMENT, ""); return filterConfig; } public Map<String, Object> customSortableAnalyzer() { Map<String, Object> analyzerConfig = new LinkedHashMap<>(); analyzerConfig.put(TYPE, CUSTOM); analyzerConfig.put(TOKENIZER, Tokenizer.keyword.id()); analyzerConfig.put(FILTER, Arrays.asList(Filter.asciifolding.id(), Filters.CUSTOM_REMOVE_SPACE_FILTER, Filter.uppercase.id())); return analyzerConfig; } public Map<String, Object> customOnlyKeepAlphaFilter() { Map<String, Object> filterConfig = new LinkedHashMap<>(); filterConfig.put(TYPE, Filter.pattern_replace.id()); String pattern = "[^A-Za-z]"; filterConfig.put(PATTERN, pattern); filterConfig.put(REPLACEMENT, ""); return filterConfig; } public Map<String, Object> customSortableOnlyAlphaAnalyzer() { Map<String, Object> analyzerConfig = new LinkedHashMap<>(); analyzerConfig.put(TYPE, CUSTOM); analyzerConfig.put(TOKENIZER, Tokenizer.keyword.id()); analyzerConfig.put(FILTER, Arrays.asList(Filter.asciifolding.id(), Filter.uppercase.id(), Filters.CUSTOM_ONLY_KEEP_ALPHA_FILTER)); return analyzerConfig; } public Map<String, Object> customOnlyKeepAlphaNumericFilter() { Map<String, Object> filterConfig = new LinkedHashMap<>(); filterConfig.put(TYPE, Filter.pattern_replace.id()); String pattern = "[^A-Za-z0-9]"; filterConfig.put(PATTERN, pattern); filterConfig.put(REPLACEMENT, ""); return filterConfig; } public Map<String, Object> customSortableOnlyAlphaNumericAnalyzer() { Map<String, Object> analyzerConfig = new LinkedHashMap<>(); analyzerConfig.put(TYPE, CUSTOM); analyzerConfig.put(TOKENIZER, Tokenizer.keyword.id()); analyzerConfig.put(FILTER, Arrays.asList(Filter.asciifolding.id(), Filter.uppercase.id(), Filters.CUSTOM_ONLY_KEEP_ALPHANUMERIC_FILTER)); return analyzerConfig; } // @Value("${elasticCustomizer.index.highlightMaxAnalyzedOffset:1000000}") // // 10_000_000 private Integer highlightMaxAnalyzedOffset = 1_000_000; // @Value("${elasticCustomizer.index.maxResultWindow:10000}") // 100_000 private Integer maxResultWindow = 10_000; // @Value("${elasticCustomizer.cluster.searchMaxBuckets:10000}") // 100_000 private Integer searchMaxBuckets = 10_000; public Integer getHighlightMaxAnalyzedOffset() { return highlightMaxAnalyzedOffset; } public void setHighlightMaxAnalyzedOffset(Integer highlightMaxAnalyzedOffset) { this.highlightMaxAnalyzedOffset = highlightMaxAnalyzedOffset; } public Integer getMaxResultWindow() { return maxResultWindow; } public void setMaxResultWindow(Integer maxResultWindow) { this.maxResultWindow = maxResultWindow; } public Integer getSearchMaxBuckets() { return searchMaxBuckets; } public void setSearchMaxBuckets(Integer searchMaxBuckets) { this.searchMaxBuckets = searchMaxBuckets; } public Map<String, Object> customAnyLanguageAnalyzer() { Map<String, Object> analyzerConfig = new LinkedHashMap<>(); analyzerConfig.put(TYPE, CUSTOM); analyzerConfig.put(TOKENIZER, Tokenizer.standard.id()); analyzerConfig.put(FILTER, Arrays.asList(Filter.apostrophe.id(), Filter.asciifolding.id(), Filter.lowercase.id())); return analyzerConfig; } public static final List<Analyzer> ANALYZER_EXCLUDE_TRYOUTS = Arrays.asList(// Analyzer.language_japanese, // Analyzer.language_chinese, // Analyzer.language_korean, // Analyzer.language_ukrainian, // Analyzer.language_polish// ); private Map<String, String> replaceAnalyzers = new LinkedHashMap<>(); public Map<String, String> getReplaceAnalyzers() { return this.replaceAnalyzers; } public void setReplaceAnalyzers(Map<String, String> replaceAnalyzers) { this.replaceAnalyzers = replaceAnalyzers; } public String replaceAnalyze(String analyzer) { return Optional.ofNullable(replaceAnalyzers.get(analyzer)).orElse(analyzer); } public Map<String, Object> customFrenchElisionFilter() { Map<String, Object> filterConfig = new LinkedHashMap<>(); filterConfig.put(TYPE, Filter.elision.id()); filterConfig.put(ARTICLES_CASE, true); filterConfig.put(ARTICLES, Arrays.asList("l", "m", "t", "qu", "n", "s", "j", "d", "c", "jusqu", "quoiqu", "lorsqu", "puisqu")); return filterConfig; } public Map<String, Object> customFrenchLanguageAnalyzer() { Map<String, Object> analyzerConfig = new LinkedHashMap<>(); analyzerConfig.put(TYPE, CUSTOM); analyzerConfig.put(TOKENIZER, Tokenizer.standard.id()); analyzerConfig.put(FILTER, Arrays.asList(// Filters.CUSTOM_FRENCH_ELISION_FILTER, // Filter.lowercase.id(), // Filter.asciifolding.id(), // Filters.CUSTOM_FRENCH_STOP_FILTER, // Filters.CUSTOM_FRENCH_STEMMER_FILTER// )); return analyzerConfig; } }
Rbasovnik/IngresoUTN2019
1-EntradaSalida/jsEntradaSalida-1.js
//Debemos lograr mostrar un mensaje al presionar el botón 'MOSTRAR'. function Mostrar() { //alert("Esto funciona de maravilla"); /* //parcial ej 7 var nota; var sexo; var promedio; var notaBaja; var contadorVaronesMas5=0 ; var flag=0; var acumuladorNotas=0; var sexoNotaBaja; var cantidad = 3; for (var i = 0 ; i < cantidad ; i++){ nota = parseInt(prompt("Ingrese nota")); while(isNaN(nota) || nota < 0 || nota > 10){ nota = parseInt(prompt("Nota invalida. Ingrese nota")); } sexo = prompt("Ingrese sexo").toLowerCase(); while(sexo != "f" && sexo != "m"){ sexo = prompt("Error. Ingrese sexo").toLowerCase(); } if(nota < notaBaja || flag == 0){ notaBaja = nota; sexoNotaBaja = sexo; flag = 1; } if(nota >= 6 && sexo == "m"){ contadorVaronesMas5++; } acumuladorNotas += nota; } promedio = (acumuladorNotas / cantidad).toFixed(2); alert("El promedio de las notas totales es = " + promedio + "\nLa nota mas baja es = " + notaBaja + " y su sexo es " + sexoNotaBaja + "\nLa cantidad de varones cuya nota es mayor o igual a 6 es = " + contadorVaronesMas5); alert("La nota mas baja es = " + notaBaja + " y su sexo es " + sexoNotaBaja); alert("La cantidad de varones cuya nota es mayor o igual a 6 es = " + contadorVaronesMas5); */ //parcial ej 8 var numero; var contadorPares = 0; var contadorImpares = 0; var promedio; var acumuladorNumeros = 0; var maximo; var minimo; var seguir; var flag = 0; var contadorNumeros = 0; do{ numero = parseInt(prompt("Ingrese un numero positivo")); while (isNaN(numero) || numero < 0){ numero = parseInt(prompt("Error. Ingrese un numero positivo")); } if(numero % 2 == 0){ contadorPares++; } else{ contadorImpares++; } if(numero > maximo || flag == 0){ maximo = numero; } if(numero < minimo || flag == 0){ minimo = numero; flag = 1; } acumuladorNumeros += numero; contadorNumeros++; seguir = confirm ("Desea seguir?"); }while (seguir); promedio = acumuladorNumeros / contadorNumeros; document.write("La cantidad de numeros pares es: " + contadorPares + "<br>"); document.write("La cantidad de numeros impares es: " + contadorImpares + "<br>"); document.write("El promedio de todos los numeros ingresados es: " + promedio.toFixed() + "<br>"); document.write("La suma de todos los numeros es: " + acumuladorNumeros + "<br>"); document.write("El numero maximo es: " + maximo + " y el minimo es: " + minimo + "<br>"); }
ErnestHolloway8482/QV21-codingexercise-holloway
app/src/androidTest/java/qv21/codingexercise/viewmodeltests/SplashVMTest.java
<filename>app/src/androidTest/java/qv21/codingexercise/viewmodeltests/SplashVMTest.java package qv21.codingexercise.viewmodeltests; import android.support.test.runner.AndroidJUnit4; import org.junit.After; import org.junit.Assert; import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; import java.io.InputStream; import javax.inject.Inject; import qv21.codingexercise.BaseAndroidUnitTest; import qv21.codingexercise.R; import qv21.codingexercise.facades.WellDataFacade; import qv21.codingexercise.managers.MainActivityProviderManager; import qv21.codingexercise.managers.NavigationManager; import qv21.codingexercise.managers.ScreenManager; import qv21.codingexercise.models.viewmodels.SplashVM; import qv21.codingexercise.utilities.RawFileUtility; import qv21.codingexercise.views.WellDataListScreen; @RunWith(AndroidJUnit4.class) public class SplashVMTest extends BaseAndroidUnitTest { @Inject WellDataFacade wellDataFacade; @Inject NavigationManager navigationManager; @Inject MainActivityProviderManager mainActivityProviderManager; @Inject ScreenManager screenManager; private SplashVM splashVM; @Before public void setup() { getTestAppComponent().inject(this); } @After public void tearDown() { wellDataFacade.cleanUpWellData(); } @Test public void seedWellDataBeforeSettingUpTheWellDataListScreenTest() { Assert.assertFalse(wellDataFacade.doesWellDataExist()); splashVM = new SplashVM(wellDataFacade, navigationManager, mainActivityProviderManager, screenManager); sleep(10); Assert.assertTrue(wellDataFacade.doesWellDataExist()); sleep(2); Assert.assertTrue(navigationManager.isOnLastScreen()); Assert.assertTrue(navigationManager.peek() instanceof WellDataListScreen); } @Test public void setupWellDataListScreenTest() { InputStream inputStream = RawFileUtility.getInputStreamFromResourceId(mainActivityProviderManager.getResources(), R.raw.well_data); Assert.assertTrue(wellDataFacade.seedWellDataIntoDatabase(inputStream)); sleep(10); splashVM = new SplashVM(wellDataFacade, navigationManager, mainActivityProviderManager, screenManager); Assert.assertTrue(wellDataFacade.doesWellDataExist()); sleep(10); Assert.assertTrue(navigationManager.peek() instanceof WellDataListScreen); } }
nurnware/ray-microkernel
src/Include/cmdline.h
#ifndef _CMDLINE_H #define _CMDLINE_H /** * @file cmdline.h * @author <NAME> * @date 09-13-2006 * @brief Checks and analyses the kernel command line */ /** * parses the command line * @param cmdline The command line from the multiboot bootloader (e.g. grub) */ void KernelParseCommandLine(String cmdline); void KernelDoCommandLine(); #endif
rajyan/AtCoder
ABC/ABC014/Source.cpp
<filename>ABC/ABC014/Source.cpp<gh_stars>1-10 //#include <cassert> //#include <cstdio> //#include <cmath> //#include <iostream> //#include <iomanip> //#include <sstream> //#include <vector> //#include <set> //#include <map> //#include <queue> //#include <numeric> //#include <algorithm> // //using namespace std; //using lint = long long; //constexpr int MOD = 1000000007, INF = 1010101010; //constexpr lint LINF = 1LL << 60; // //#ifdef _DEBUG //#include "../../../../library/src/debug_template.hpp" //#define DMP(...) dump(#__VA_ARGS__, __VA_ARGS__) //#else //#define DMP(...) ((void)0) //#endif // //struct init { // init() { // cin.tie(nullptr); ios::sync_with_stdio(false); // cout << fixed << setprecision(10); // } //} init_; // //class LCA { //private: // // int N, lg_N; // vector<int> depth; // vector<vector<int>> par; // // void build(const vector<vector<int>> &graph, int root) { // // auto dfs = [&](auto &&f, int now) -> void { // // for (const auto &next : graph[now]) { // if (par[0][next] == -1) { // par[0][next] = now; // depth[next] = depth[now] + 1; // f(f, next); // } // } // // }; // // par[0][root] = root; // dfs(dfs, root); // // for (int bit = 0; bit < lg_N; bit++) { // for (int i = 0; i < N; i++) { // par[bit + 1][i] = par[bit][par[bit][i]]; // } // } // } // // int ancestor(int now, int n) { // if (n <= 0) return now; // for (int i = 0, lg_n = 32 - nlz(n); i < lg_n; i++) { // if (n & (1LL << i)) now = par[i][now]; // } // return now; // } // // int nlz(unsigned int x) { // union { // unsigned int as_uint32; // float as_float; // } data; // data.as_float = (float)x + 0.5; // int n = 158 - (data.as_uint32 >> 23); // return n; // } // //public: // LCA(const vector<vector<int>> &edges, int root = 0) : N(edges.size()), lg_N(32 - nlz(N)), depth(N), par(lg_N + 1, vector<int>(N, -1)) { build(edges, root); } // // int get_lca(int u, int v) { // // if (depth[u] < depth[v]) swap(u, v); // u = ancestor(u, depth[u] - depth[v]); // if (u == v) return u; // // for (int i = 32 - nlz(depth[u]); i >= 0; i--) { // if (par[i][u] != par[i][v]) { // u = par[i][u]; // v = par[i][v]; // } // } // return par[0][u]; // } // // int dist(int u, int v) { // return depth[u] + depth[v] - 2 * depth[get_lca(u, v)]; // } //}; // //int main() { // // int N; // cin >> N; // // vector<vector<int>> edges(N); // for (int i = 0; i < N - 1; i++) { // int u, v; // cin >> u >> v; // u--, v--; // edges[u].emplace_back(v); // edges[v].emplace_back(u); // } // // LCA lca(edges); // // int Q; // cin >> Q; // // for (int i = 0; i < Q; i++) { // int x, y; // cin >> x >> y; // x--, y--; // cout << lca.dist(x, y) + 1 << "\n"; // } // // return 0; //}
diku-dk/PROX
PROX/SIMULATION/CONTENT/CONTENT/src/content_channels_storage.cpp
#include <content_channels.h> namespace content { //-------------------------------------------------------------------------------- void ChannelStorage::clear() { m_channels.clear(); } //-------------------------------------------------------------------------------- size_t ChannelStorage::create_channel( size_t const & id, std::string const & name ) { Channel C; C.m_id = id; C.m_name = name; m_channels.push_back(C); return m_channels.size()-1u; } //-------------------------------------------------------------------------------- size_t ChannelStorage::create_key( size_t const & channel_idx, float const & time ) { KeyTick K; K.m_time = time; m_channels[channel_idx].m_keys.push_back(K); return m_channels[channel_idx].m_keys.size() - 1u; } //-------------------------------------------------------------------------------- void ChannelStorage::set_key_position( size_t const & channel_idx, size_t const & key_idx, float const & x, float const & y, float const & z ) { m_channels[channel_idx].m_keys[key_idx].m_x = x; m_channels[channel_idx].m_keys[key_idx].m_y = y; m_channels[channel_idx].m_keys[key_idx].m_z = z; } //-------------------------------------------------------------------------------- void ChannelStorage::set_key_orientation( size_t const & channel_idx, size_t const & key_idx, float const & qs, float const & qx, float const & qy, float const & qz ) { m_channels[channel_idx].m_keys[key_idx].m_qs = qs; m_channels[channel_idx].m_keys[key_idx].m_qx = qx; m_channels[channel_idx].m_keys[key_idx].m_qy = qy; m_channels[channel_idx].m_keys[key_idx].m_qz = qz; } //-------------------------------------------------------------------------------- size_t ChannelStorage::get_number_of_channels() const { return m_channels.size(); } //-------------------------------------------------------------------------------- size_t ChannelStorage::get_channel_id( size_t const & channel_index ) const { return m_channels[channel_index].m_id; } //-------------------------------------------------------------------------------- std::string const & ChannelStorage::get_channel_name( size_t const & channel_index ) const { return m_channels[channel_index].m_name; } //-------------------------------------------------------------------------------- size_t ChannelStorage::get_number_of_keys(size_t const & channel_index) const { return m_channels[channel_index].m_keys.size(); } //-------------------------------------------------------------------------------- float ChannelStorage::get_key_time( size_t const & channel_index, size_t const & key_index ) const { return m_channels[channel_index].m_keys[key_index].m_time; } //-------------------------------------------------------------------------------- void ChannelStorage::get_key_position( size_t const & channel_index , size_t const & key_index , float & x , float & y , float & z ) const { x = m_channels[channel_index].m_keys[key_index].m_x; y = m_channels[channel_index].m_keys[key_index].m_y; z = m_channels[channel_index].m_keys[key_index].m_z; } //-------------------------------------------------------------------------------- void ChannelStorage::get_key_orientation( size_t const & channel_index , size_t const & key_index , float & qs , float & qx , float & qy , float & qz ) const { qs = m_channels[channel_index].m_keys[key_index].m_qs; qx = m_channels[channel_index].m_keys[key_index].m_qx; qy = m_channels[channel_index].m_keys[key_index].m_qy; qz = m_channels[channel_index].m_keys[key_index].m_qz; } //-------------------------------------------------------------------------------- }// namespace content
wanghaiyang-github/dna-cloud
bazl-dna-database-service/src/main/java/com/bazl/dna/database/service/service/impl/DnaPanelInfoServiceImpl.java
<filename>bazl-dna-database-service/src/main/java/com/bazl/dna/database/service/service/impl/DnaPanelInfoServiceImpl.java<gh_stars>0 package com.bazl.dna.database.service.service.impl; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.bazl.dna.database.service.mapper.DnaLocusInfoMapper; import com.bazl.dna.database.service.mapper.DnaPanelLocusMapper; import com.bazl.dna.database.service.model.po.*; import com.bazl.dna.database.service.mapper.DnaPanelInfoMapper; import com.bazl.dna.database.service.model.qo.DnaPanelInfoQuery; import com.bazl.dna.database.service.service.DnaPanelInfoService; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.cache.annotation.Cacheable; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import java.util.ArrayList; import java.util.List; /** * <p> * 试剂盒信息表 服务实现类 * </p> * * @author lizhihua * @since 2020-02-11 */ @Service @Transactional public class DnaPanelInfoServiceImpl extends ServiceImpl<DnaPanelInfoMapper, DnaPanelInfo> implements DnaPanelInfoService { private static final String CACHE_NAME = "DnaPanelInfo"; @Autowired private DnaPanelInfoMapper dnaPanelInfoMapper; @Autowired private DnaPanelLocusMapper dnaPanelLocusMapper; @Autowired private DnaLocusInfoMapper dnaLocusInfoMapper; @Override @Cacheable(value = CACHE_NAME + ":panelInfoQuery", keyGenerator="keyGenerator") public List<PanelInfoQuery> panelInfoQuery(DnaPanelInfo dnaPanelInfo) { ArrayList<PanelInfoQuery> panelInfoQueries = new ArrayList<>(); if (dnaPanelInfo != null){ List<DnaPanelInfo> dnaPanelInfoList = dnaPanelInfoMapper.panelInfoQueryList(dnaPanelInfo); for (DnaPanelInfo panelInfo : dnaPanelInfoList) { DnaPanelLocus panelId = dnaPanelLocusMapper.selectOne(new QueryWrapper<DnaPanelLocus>().eq("PANEL_ID", panelInfo.getId())); DnaLocusInfo dnaLocusInfo = dnaLocusInfoMapper.selectOne(new QueryWrapper<DnaLocusInfo>().eq("id", panelId.getLocusId())); PanelInfoQuery panelInfoQuery = new PanelInfoQuery(); panelInfoQuery.setPanelName(panelInfo.getPanelName()); panelInfoQuery.setCoreLocusFlag(panelId.getLocusOrd().toString()); panelInfoQuery.setLocusOrd(dnaLocusInfo.getCoreLocusFlag().toString()); panelInfoQueries.add(panelInfoQuery); } } return panelInfoQueries; } @Override @Cacheable(value = CACHE_NAME + ":selectById", key = "#dnaPanelId") public DnaPanelInfo selectById(String dnaPanelId) { return dnaPanelInfoMapper.selectOne(new QueryWrapper<DnaPanelInfo>().eq("id", dnaPanelId)); } @Override public List<DnaPanelInfo> dnaPanelInfoPaginationQuery(DnaPanelInfoQuery dnaPanelInfoQuery) { try{ return dnaPanelInfoMapper.panelPaginationQuery(dnaPanelInfoQuery); }catch (Exception ex){ log.error("invoke DnaPanelInfoService.dnaLocusInfoPaginationQuery.error! ",ex); return null; } } @Override public int insert(DnaPanelInfo panelInfo) { return dnaPanelInfoMapper.insert(panelInfo); } @Override public List<DnaPanelInfo> panelInfoList(DnaPanelInfo panelInfo) { return dnaPanelInfoMapper.panelInfoQueryList(panelInfo); } @Override public int panelPaginationCount(DnaPanelInfoQuery dnaPanelInfoQuery) { try{ int count = dnaPanelInfoMapper.panelPaginationCount(dnaPanelInfoQuery); return count; }catch (Exception ex){ log.error("invoke DnaPanelInfoService.panelPaginationCount.error! ",ex); return 0; } } }
mauriciotogneri/android-utils
androidutils/src/main/java/com/mauriciotogneri/androidutils/Connectivity.java
<reponame>mauriciotogneri/android-utils<gh_stars>1-10 package com.mauriciotogneri.androidutils; import android.annotation.SuppressLint; import android.content.Context; import android.net.ConnectivityManager; import android.net.NetworkInfo; import androidx.annotation.NonNull; public class Connectivity { private final ConnectivityManager connectivityManager; public enum Status { WIFI, MOBILE, NOT_CONNECTED } public Connectivity(@NonNull Context context) { this.connectivityManager = (ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE); } @SuppressLint("MissingPermission") private Status status() { NetworkInfo activeNetwork = connectivityManager.getActiveNetworkInfo(); if ((activeNetwork != null) && activeNetwork.isConnectedOrConnecting()) { if (activeNetwork.getType() == ConnectivityManager.TYPE_WIFI) { return Status.WIFI; } else if (activeNetwork.getType() == ConnectivityManager.TYPE_MOBILE) { return Status.MOBILE; } } return Status.NOT_CONNECTED; } public boolean isConnected() { Status status = status(); return (status == Status.MOBILE) || (status == Status.WIFI); } public boolean isConnectivityWifi() { return (status() == Status.WIFI); } public boolean isConnectivityMobile() { return (status() == Status.MOBILE); } public boolean hasInternetConnection() { return (status() != Status.NOT_CONNECTED); } }
nccasia/ncc-komubot
test/env.test.js
<reponame>nccasia/ncc-komubot const path = require('path'); const env = require('../env'); const vars = env.config({ path: path.resolve(__dirname, '..', '.env') }); console.log(vars);
d3scomp/JDEECo
jdeeco-edl-model/src/cz/cuni/mff/d3s/jdeeco/edl/model/edl/impl/FunctionCallImpl.java
<reponame>d3scomp/JDEECo /** */ package cz.cuni.mff.d3s.jdeeco.edl.model.edl.impl; import cz.cuni.mff.d3s.jdeeco.edl.model.edl.EdlPackage; import cz.cuni.mff.d3s.jdeeco.edl.model.edl.QueryVisitor; import cz.cuni.mff.d3s.jdeeco.edl.model.edl.FunctionCall; import cz.cuni.mff.d3s.jdeeco.edl.model.edl.Query; import java.lang.reflect.InvocationTargetException; import java.util.Collection; import org.eclipse.emf.common.notify.Notification; import org.eclipse.emf.common.notify.NotificationChain; import org.eclipse.emf.common.util.EList; import org.eclipse.emf.ecore.EClass; import org.eclipse.emf.ecore.InternalEObject; import org.eclipse.emf.ecore.impl.ENotificationImpl; import org.eclipse.emf.ecore.impl.MinimalEObjectImpl; import org.eclipse.emf.ecore.util.EObjectContainmentEList; import org.eclipse.emf.ecore.util.InternalEList; /** * <!-- begin-user-doc --> * An implementation of the model object '<em><b>Function Call</b></em>'. * <!-- end-user-doc --> * <p> * The following features are implemented: * <ul> * <li>{@link cz.cuni.mff.d3s.jdeeco.edl.model.edl.impl.FunctionCallImpl#getName <em>Name</em>}</li> * <li>{@link cz.cuni.mff.d3s.jdeeco.edl.model.edl.impl.FunctionCallImpl#getParameters <em>Parameters</em>}</li> * </ul> * </p> * * @generated */ public class FunctionCallImpl extends MinimalEObjectImpl.Container implements FunctionCall { /** * The default value of the '{@link #getName() <em>Name</em>}' attribute. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #getName() * @generated * @ordered */ protected static final String NAME_EDEFAULT = null; /** * The cached value of the '{@link #getName() <em>Name</em>}' attribute. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #getName() * @generated * @ordered */ protected String name = NAME_EDEFAULT; /** * The cached value of the '{@link #getParameters() <em>Parameters</em>}' containment reference list. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #getParameters() * @generated * @ordered */ protected EList<Query> parameters; /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ protected FunctionCallImpl() { super(); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override protected EClass eStaticClass() { return EdlPackage.Literals.FUNCTION_CALL; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public String getName() { return name; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public void setName(String newName) { String oldName = name; name = newName; if (eNotificationRequired()) eNotify(new ENotificationImpl(this, Notification.SET, EdlPackage.FUNCTION_CALL__NAME, oldName, name)); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public EList<Query> getParameters() { if (parameters == null) { parameters = new EObjectContainmentEList<Query>(Query.class, this, EdlPackage.FUNCTION_CALL__PARAMETERS); } return parameters; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated NOT */ public <T> T accept(QueryVisitor<T> visitor) { return visitor.visit(this); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) { switch (featureID) { case EdlPackage.FUNCTION_CALL__PARAMETERS: return ((InternalEList<?>)getParameters()).basicRemove(otherEnd, msgs); } return super.eInverseRemove(otherEnd, featureID, msgs); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public Object eGet(int featureID, boolean resolve, boolean coreType) { switch (featureID) { case EdlPackage.FUNCTION_CALL__NAME: return getName(); case EdlPackage.FUNCTION_CALL__PARAMETERS: return getParameters(); } return super.eGet(featureID, resolve, coreType); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @SuppressWarnings("unchecked") @Override public void eSet(int featureID, Object newValue) { switch (featureID) { case EdlPackage.FUNCTION_CALL__NAME: setName((String)newValue); return; case EdlPackage.FUNCTION_CALL__PARAMETERS: getParameters().clear(); getParameters().addAll((Collection<? extends Query>)newValue); return; } super.eSet(featureID, newValue); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public void eUnset(int featureID) { switch (featureID) { case EdlPackage.FUNCTION_CALL__NAME: setName(NAME_EDEFAULT); return; case EdlPackage.FUNCTION_CALL__PARAMETERS: getParameters().clear(); return; } super.eUnset(featureID); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public boolean eIsSet(int featureID) { switch (featureID) { case EdlPackage.FUNCTION_CALL__NAME: return NAME_EDEFAULT == null ? name != null : !NAME_EDEFAULT.equals(name); case EdlPackage.FUNCTION_CALL__PARAMETERS: return parameters != null && !parameters.isEmpty(); } return super.eIsSet(featureID); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override @SuppressWarnings({"rawtypes", "unchecked" }) public Object eInvoke(int operationID, EList<?> arguments) throws InvocationTargetException { switch (operationID) { case EdlPackage.FUNCTION_CALL___ACCEPT__QUERYVISITOR: return accept((QueryVisitor)arguments.get(0)); } return super.eInvoke(operationID, arguments); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public String toString() { if (eIsProxy()) return super.toString(); StringBuffer result = new StringBuffer(super.toString()); result.append(" (name: "); result.append(name); result.append(')'); return result.toString(); } } //FunctionCallImpl
btjanaka/competitive-programming-solutions
kattis/zebrasocelots.cpp
<filename>kattis/zebrasocelots.cpp // Author: btjanaka (<NAME>) // Problem: (Kattis) zebrasocelots // Title: Zebras and Ocelots // Link: https://open.kattis.com/problems/zebrasocelots // Idea: // Difficulty: easy // Tags: #include <bits/stdc++.h> #define GET(x) scanf("%d", &x) #define GED(x) scanf("%lf", &x) typedef long long ll; using namespace std; int n; char zo[100]; int main() { GET(n); for (int i = 0; i < n; ++i) { scanf(" %c", zo + i); } long long res = 0; for (int i = n - 1; i >= 0; --i) { if (zo[i] == 'O') { res += (1L << (n - i - 1)); } } printf("%lld\n", res); return 0; }
shenzulun/IEasyTool
src/main/java/me/belucky/easytool/random/IdCardRandom.java
/** * File Name: IdCardRandom.java * Date: 2016-9-19 下午02:22:58 */ package me.belucky.easytool.random; import java.util.ArrayList; import java.util.List; import me.belucky.easytool.util.IDCardGenerateUtil; /** * 功能说明: 随机生成身份信息 * @author shenzl * @date 2016-9-19 * @version 1.0 */ public class IdCardRandom { /** * 随机生成身份信息 * @return */ public static IdCard randOne(){ String fullName = NameRandom.randFullName(); String certno = IDCardGenerateUtil.random(); return new IdCard(fullName, certno); } /** * 随机生成身份信息-不公平模式 * @return */ public static IdCard randOneUnFair(){ String fullName = NameRandom.randFullNameUnFair(); String certno = IDCardGenerateUtil.random(); return new IdCard(fullName, certno); } /** * 随机生成一组身份信息 * @param counts * @return */ public static List<IdCard> randList(int counts){ List<IdCard> cards = new ArrayList<IdCard>(); for(int i=0;i<counts;i++){ cards.add(randOne()); } return cards; } /** * 随机生成一组身份信息-不公平模式 * @param counts * @return */ public static List<IdCard> randListUnFair(int counts){ List<IdCard> cards = new ArrayList<IdCard>(); for(int i=0;i<counts;i++){ cards.add(randOneUnFair()); } return cards; } }
revoiid/sven_internal
sven_internal/patterns.h
<reponame>revoiid/sven_internal // Patterns #pragma once #include "utils/patterns_base.h" namespace Patterns { namespace Interfaces { EXTERN_PATTERN(EngineFuncs); EXTERN_PATTERN(ClientFuncs); EXTERN_PATTERN(EngineStudio); } namespace Hardware { EXTERN_PATTERN(flNextCmdTime); EXTERN_PATTERN(Netchan_CanPacket); EXTERN_PATTERN(Netchan_Transmit); EXTERN_PATTERN(V_RenderView); EXTERN_PATTERN(V_SetupFrame); EXTERN_PATTERN(R_LoadSkyboxInt); } namespace Client { EXTERN_PATTERN(CVotePopup__MsgFunc_VoteMenu); EXTERN_PATTERN(READ_BYTE); EXTERN_PATTERN(READ_STRING); EXTERN_PATTERN(CHudBaseTextBlock__Print); EXTERN_PATTERN(CVoiceBanMgr__SaveState); EXTERN_PATTERN(CVoiceBanMgr__SetPlayerBan); EXTERN_PATTERN(CVoiceBanMgr__InternalFindPlayerSquelch); EXTERN_PATTERN(CVoiceStatus__IsPlayerBlocked); EXTERN_PATTERN(CVoiceStatus__SetPlayerBlockedState); EXTERN_PATTERN(CVoiceStatus__UpdateServerState); EXTERN_PATTERN(HACK_GetPlayerUniqueID); EXTERN_PATTERN(GetClientColor); EXTERN_PATTERN(CHud__Think); EXTERN_PATTERN(WeaponsResource__GetFirstPos); } namespace GameOverlay { EXTERN_PATTERN(SetCursorPos_Hook); EXTERN_PATTERN(ValveUnhookFunc); } }
pethersonmoreno/secretvault
controllers/key/routeKey.go
package key import ( "github.com/gin-gonic/gin" ) func RouteKey(router *gin.Engine) { secretKey := router.Group("/key") secretKey.PUT("/intermediateKey", updateIntermediateKeyHandler) secretKey.PUT("/openingKey", updateOpeningKeyHandler) secretKey.POST("", createKeyHandler) secretKey.POST("/generateRsaKey", generateRsaKeyHandler) }
Mbompr/deepr
tests/unit/layers/test_layers_mask.py
<reponame>Mbompr/deepr<filename>tests/unit/layers/test_layers_mask.py """Tests for layers.mask""" import numpy as np import tensorflow as tf import deepr as dpr def test_layers_mask_equal(): """Test for Equal""" layer = dpr.layers.Equal(values=(0, 1)) result = layer(tf.constant([0, 1, 2])) with tf.Session() as sess: got = sess.run(result) np.testing.assert_equal(got, [True, True, False]) def test_layers_mask_not_equal(): """Test for NotEqual""" layer = dpr.layers.NotEqual(values=(0, 1)) result = layer(tf.constant([0, 1, 2])) with tf.Session() as sess: got = sess.run(result) np.testing.assert_equal(got, [False, False, True]) def test_layers_boolean_mask(): """Test for BooleanMask""" layer = dpr.layers.BooleanMask() result = layer((tf.constant([0, 1, 2]), tf.constant([True, False, True]))) with tf.Session() as sess: got = sess.run(result) np.testing.assert_equal(got, [0, 2]) def test_layers_look_ahead_mask(): """Test for LookAheadMask""" layer = dpr.layers.LookAheadMask() tensor = tf.random.uniform((1, 3)) result = layer(tensor) expected = [[0, 1, 1], [0, 0, 1], [0, 0, 0]] with tf.Session() as sess: got = sess.run(result) np.testing.assert_equal(got, expected) def test_layers_padding_mask(): """Test for PaddingMask""" layer = dpr.layers.PaddingMask(padded_value=-1) tensor = [1, 2, 3, -1, -1, 4] result = layer(tensor) expected = [0, 0, 0, 1, 1, 0] with tf.Session() as sess: got = sess.run(result) np.testing.assert_equal(got, expected)
jiadaizhao/LintCode
1201-1300/1218-Number Complement/1218-Number Complement.py
<reponame>jiadaizhao/LintCode class Solution: """ @param num: an integer @return: the complement number """ def findComplement(self, num): # Write your code here limit = 1 while limit <= num: limit <<= 1 return limit - 1 - num
mahdanidani/google-api-ads-ruby
dfp_api/examples/v201502/custom_field_service/create_custom_field_options.rb
<filename>dfp_api/examples/v201502/custom_field_service/create_custom_field_options.rb #!/usr/bin/env ruby # Encoding: utf-8 # # Copyright:: Copyright 2012, Google Inc. All Rights Reserved. # # License:: 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. # # This example creates custom field options for a drop-down custom field. Once # created, custom field options can be found under the options fields of the # drop-down custom field and they cannot be deleted. To determine which custom # fields exist, run get_all_custom_fields.rb. require 'dfp_api' API_VERSION = :v201502 def create_custom_field_options() # Get DfpApi instance and load configuration from ~/dfp_api.yml. dfp = DfpApi::Api.new # To enable logging of SOAP requests, set the log_level value to 'DEBUG' in # the configuration file or provide your own logger: # dfp.logger = Logger.new('dfp_xml.log') # Get the CustomFieldService. custom_field_service = dfp.service(:CustomFieldService, API_VERSION) # Set the ID of the drop-down custom field to create options for. custom_field_id = 'INSERT_DROP_DOWN_CUSTOM_FIELD_ID_HERE'.to_i # Create local custom field options. custom_field_options = [ { :display_name => 'Approved', :custom_field_id => custom_field_id }, { :display_name => 'Unapproved', :custom_field_id => custom_field_id } ] # Create the custom field options on the server. return_custom_field_options = custom_field_service.create_custom_field_options(custom_field_options) return_custom_field_options.each do |option| puts "Custom field option with ID: %d and name: '%s' was created." % [option[:id], option[:display_name]] end end if __FILE__ == $0 begin create_custom_field_options() # HTTP errors. rescue AdsCommon::Errors::HttpError => e puts "HTTP Error: %s" % e # API errors. rescue DfpApi::Errors::ApiException => e puts "Message: %s" % e.message puts 'Errors:' e.errors.each_with_index do |error, index| puts "\tError [%d]:" % (index + 1) error.each do |field, value| puts "\t\t%s: %s" % [field, value] end end end end
blueblueblue/infinispan
commons/src/main/java/org/infinispan/commons/marshall/LambdaExternalizer.java
<gh_stars>100-1000 package org.infinispan.commons.marshall; /** * A lambda {@link AdvancedExternalizer}. * * @param <T> * @since 8.0 */ public interface LambdaExternalizer<T> extends AdvancedExternalizer<T> { ValueMatcherMode valueMatcher(Object o); }
david-buderus/PP-Manager
server/src/main/java/de/pnp/manager/main/ManagerApplication.java
package de.pnp.manager.main; import de.pnp.manager.ui.ManagerView; import javafx.application.Application; import javafx.stage.Stage; import net.ucanaccess.jdbc.UcanaccessDriver; import java.io.File; import java.sql.DriverManager; import java.sql.SQLException; public class ManagerApplication extends Application { public static void main(String[] args) { launch(args); } @Override public void start(Stage primaryStage) { try { DriverManager.registerDriver(new UcanaccessDriver()); } catch (SQLException e) { e.printStackTrace(); } ManagerView view = new ManagerView(primaryStage, this); if (this.getParameters().getRaw().size() > 0) { view.load(new File(this.getParameters().getRaw().get(0))); } } }
xk-wang/mgek_imgbed
app/api/img/image_format.py
# -*- coding: utf-8 -*- # @Author: Landers # @Github: Landers1037 # @File: image_format.py # @Date: 2020-05-15 #输出适用多种格式的图片信息 from app.api.img import img from app.database import database from flask import request from app.utils import format_response from app import global_config @img.route('/api/image_format') def image_format(): name = request.json["name"] img = database().get(global_config.engine,'image',name) res = { "raw": img["name"], "link": "{}{}".format(global_config.image_url,img["name"]), "html": "<img src={}{} alt=image>".format(global_config.image_url,img["name"]), "markdown": "![image]({}{})".format(global_config.image_url,img["name"]) } return format_response('ok',res)
xuantan/viewfinder
backend/db/user.py
<filename>backend/db/user.py # Copyright 2011 Viewfinder Inc. All Rights Reserved. """Viewfinder user. User: viewfinder user account information """ __author__ = '<EMAIL> (<NAME>)' import json from copy import deepcopy from tornado import gen, web from viewfinder.backend.base import secrets, util from viewfinder.backend.base.exceptions import InvalidRequestError from viewfinder.backend.db import db_client, vf_schema from viewfinder.backend.db.analytics import Analytics from viewfinder.backend.db.base import DBObject from viewfinder.backend.db.hash_base import DBHashObject from viewfinder.backend.db.device import Device from viewfinder.backend.db.friend import Friend from viewfinder.backend.db.id_allocator import IdAllocator from viewfinder.backend.db.identity import Identity from viewfinder.backend.db.operation import Operation from viewfinder.backend.db.settings import AccountSettings from viewfinder.backend.db.subscription import Subscription from viewfinder.backend.op.notification_manager import NotificationManager @DBObject.map_table_attributes class User(DBHashObject): """Viewfinder user account.""" __slots__ = [] # Label flags. REGISTERED = 'registered' """Full user that is authenticated by trusted authority and has explicitly accepted the TOS. If this flag is not present, then the user is a "prospective" user, which is a read-only user that has not yet been fully registered. """ STAGING = 'staging' """Beta user that is redirected to the staging cluster. If this flag is not present, then the user will be redirected to the main production cluster. """ TERMINATED = 'terminated' """The account has been terminated by the user. This user can no longer sign in, and other users can no longer share with him/her. """ SYSTEM = 'system' """System user that should not be shown in contacts even if a friend.""" _REGISTER_USER_ATTRIBUTES = set(['user_id', 'name', 'given_name', 'family_name', 'email', 'picture', 'gender', 'link', 'locale', 'timezone', 'facebook_email', 'phone', 'pwd_hash', 'salt']) """Subset of user attributes that can be set as part of user registration.""" _UPDATE_USER_ATTRIBUTES = set(['name', 'given_name', 'family_name', 'picture', 'pwd_hash', 'salt']) """Subset of user attributes that can be updated by the user.""" _USER_FRIEND_ATTRIBUTES = set(['user_id', 'name', 'given_name', 'family_name', 'email', 'picture', 'merged_with']) """Subset of user attributes that are visible to friends.""" _USER_NON_FRIEND_LABELS = set([REGISTERED, TERMINATED, SYSTEM]) """Subset of user labels that are visible to non-friends.""" _USER_FRIEND_LABELS = _USER_NON_FRIEND_LABELS """Subset of user labels that are visible to friends.""" _table = DBObject._schema.GetTable(vf_schema.USER) _ALLOCATION = 1 _allocator = IdAllocator(id_type=_table.hash_key_col.name, allocation=_ALLOCATION) _RESERVED_ASSET_ID_COUNT = 1 """Number of asset ids which are reserved for system use (default vp for now).""" DEFAULT_VP_ASSET_ID = 0 """Asset id used in the default viewpoint id.""" def __init__(self, user_id=None): """Creates a new user.""" super(User, self).__init__() self.user_id = user_id def IsRegistered(self): """Returns true if this is a fully registered user that has been authenticated by a trusted authority. """ return User.REGISTERED in self.labels def IsStaging(self): """Returns true if this user should always be redirected to the staging cluster. """ return User.STAGING in self.labels def IsTerminated(self): """Returns true if this user's account has been terminated.""" return User.TERMINATED in self.labels def IsSystem(self): """Returns true if this user is a system user.""" return User.SYSTEM in self.labels @gen.coroutine def MakeSystemUser(self, client): """Adds the SYSTEM label to this user.""" self.labels.add(User.SYSTEM) yield gen.Task(self.Update, client) def QueryIdentities(self, client, callback): """Queries the identities (if any) attached to this user and returns the list to the provided callback. """ query_str = 'identity.user_id=%d' % self.user_id Identity.IndexQuery(client, query_str, col_names=None, callback=callback) @gen.coroutine def QueryPrimaryIdentity(self, client): """Method to return the primary identity associated with an account. This currently only works for prospective users, which are guaranteed to have a single identity. The method is being created with a more general signature so that it will be useful once the anticipated concept of a primary identity is introduced. """ assert not self.IsRegistered(), 'QueryPrimaryIdentity is currently only permitted for Prospective users.' identities = yield gen.Task(self.QueryIdentities, client) assert len(identities) == 1, 'Encountered prospective user %d with multiple identities.' % self.user_id raise gen.Return(identities[0]) @classmethod def ShouldScrubColumn(cls, name): """Returns list of column names that should not be printed in logs.""" return name in ['signing_key', 'pwd_hash', 'salt'] def MakeLabelList(self, is_friend): """Returns a list suitable for the 'labels' field of USER_PROFILE_METADATA. If 'is_friend' is True, returns labels accessible to friends; if it is false, returns only labels accessible to strangers. """ if is_friend: labels = [label for label in self.labels if label in User._USER_FRIEND_LABELS] labels.append('friend') return labels else: return [label for label in self.labels if label in User._USER_NON_FRIEND_LABELS] @gen.engine def MakeUserMetadataDict(self, client, viewer_user_id, forward_friend, reverse_friend, callback): """Projects a subset of the user attributes that can be provided to the viewing user (using the same schema as the query_users service method). The 'forward_friend' is viewer_user_id => friend_user_id, and the 'reverse_friend' is the reverse. This user's profile information will only be provided to the viewer if the viewer is a reverse friend (i.e. user considers the viewer a friend). The 'private' block will be returned only if viewer_user_id == self.user_id. """ user_dict = {'user_id': self.user_id} # First, populate basic user data, but only if the user considers the viewer a friend. if reverse_friend is not None: for attr_name in User._USER_FRIEND_ATTRIBUTES: util.SetIfNotNone(user_dict, attr_name, getattr(self, attr_name, None)) user_dict['labels'] = self.MakeLabelList(True) else: # Set labels which are visible to non-friends. user_dict['labels'] = self.MakeLabelList(False) # Now project friend attributes. for attr_name in Friend.FRIEND_ATTRIBUTES: util.SetIfNotNone(user_dict, attr_name, getattr(forward_friend, attr_name, None)) # Now fill out private attributes if this user is also the viewing user. if viewer_user_id == self.user_id: user_dict['private'] = {} if self.pwd_hash is None: user_dict['private']['no_password'] = True subs, settings = yield [gen.Task(Subscription.QueryByUser, client, user_id=self.user_id), gen.Task(AccountSettings.QueryByUser, client, self.user_id, None, must_exist=False)] sub_dicts = [sub.MakeMetadataDict() for sub in subs] user_dict['private']['subscriptions'] = sub_dicts if settings is not None: user_dict['private']['account_settings'] = settings.MakeMetadataDict() def _MakeIdentityDict(ident): i_dict = {'identity': ident.key} if ident.authority is not None: i_dict['authority'] = ident.authority return i_dict query_expr = 'identity.user_id=%d' % self.user_id identities = yield gen.Task(Identity.IndexQuery, client, query_expr, ['key', 'authority']) user_dict['private']['user_identities'] = [_MakeIdentityDict(ident) for ident in identities] callback(user_dict) @classmethod def AllocateAssetIds(cls, client, user_id, num_ids, callback): """Allocates 'num_ids' new ids from the 'asset_id_seq' column in a block for the specified user id and returns the first id in the sequence (first_id, ..., first_id + num_ids] with the callback """ id_seq_key = cls._table.GetColumn('asset_id_seq').key def _OnUpdateIdSeq(result): last_id = result.return_values[id_seq_key] first_id = last_id - num_ids callback(first_id) client.UpdateItem(table=cls._table.name, key=db_client.DBKey(hash_key=user_id, range_key=None), attributes={id_seq_key: db_client.UpdateAttr(value=num_ids, action='ADD')}, return_values='UPDATED_NEW', callback=_OnUpdateIdSeq) @classmethod @gen.coroutine def AllocateUserAndWebDeviceIds(cls, client): """Allocates a new user id and a new web device id and returns them in a tuple.""" user_id = yield gen.Task(User._allocator.NextId, client) webapp_dev_id = yield gen.Task(Device._allocator.NextId, client) raise gen.Return((user_id, webapp_dev_id)) @classmethod @gen.engine def QueryUsers(cls, client, viewer_user_id, user_ids, callback): """Queries User objects for each id in the 'user_ids' list. Invokes 'callback' with a list of (user, forward_friend, reverse_friend) tuples. Non-existent users are omitted. """ user_keys = [db_client.DBKey(user_id, None) for user_id in user_ids] forward_friend_keys = [db_client.DBKey(viewer_user_id, user_id) for user_id in user_ids] reverse_friend_keys = [db_client.DBKey(user_id, viewer_user_id) for user_id in user_ids] users, forward_friends, reverse_friends = \ yield [gen.Task(User.BatchQuery, client, user_keys, None, must_exist=False), gen.Task(Friend.BatchQuery, client, forward_friend_keys, None, must_exist=False), gen.Task(Friend.BatchQuery, client, reverse_friend_keys, None, must_exist=False)] user_friend_list = [] for user, forward_friend, reverse_friend in zip(users, forward_friends, reverse_friends): if user is not None: user_friend_list.append((user, forward_friend, reverse_friend)) callback(user_friend_list) @classmethod @gen.coroutine def CreateProspective(cls, client, user_id, webapp_dev_id, identity_key, timestamp): """Creates a prospective user with the specified user id. web device id, and identity key. A prospective user is typically created when photos are shared with a contact that is not yet a Viewfinder user. Returns a tuple containing the user and identity. """ from viewfinder.backend.db.viewpoint import Viewpoint identity_type, identity_value = Identity.SplitKey(identity_key) # Ensure that identity is created. identity = yield gen.Task(Identity.CreateProspective, client, identity_key, user_id, timestamp) # Create the default viewpoint. viewpoint = yield Viewpoint.CreateDefault(client, user_id, webapp_dev_id, timestamp) # By default, send alerts when a new conversation is started. Send email alerts if the # identity is email, or sms alerts if the identity is phone. email_alerts = AccountSettings.EMAIL_ON_SHARE_NEW if identity_type == 'Email' else AccountSettings.EMAIL_NONE sms_alerts = AccountSettings.SMS_ON_SHARE_NEW if identity_type == 'Phone' else AccountSettings.SMS_NONE settings = AccountSettings.CreateForUser(user_id, email_alerts=email_alerts, sms_alerts=sms_alerts, push_alerts=AccountSettings.PUSH_NONE) yield gen.Task(settings.Update, client) # Create a Friend relation (every user is friends with himself). friend = Friend.CreateFromKeywords(user_id=user_id, friend_id=user_id) yield gen.Task(friend.Update, client) # Create the prospective user. email = identity_value if identity_type == 'Email' else None phone = identity_value if identity_type == 'Phone' else None user = User.CreateFromKeywords(user_id=user_id, private_vp_id=viewpoint.viewpoint_id, webapp_dev_id=webapp_dev_id, email=email, phone=phone, asset_id_seq=User._RESERVED_ASSET_ID_COUNT, signing_key=secrets.CreateSigningKeyset('signing_key')) yield gen.Task(user.Update, client) raise gen.Return((user, identity)) @classmethod @gen.coroutine def Register(cls, client, user_dict, ident_dict, timestamp, rewrite_contacts): """Registers a user or updates its attributes using the contents of "user_dict". Updates an identity using the contents of "ident_dict" and ensures its linked to the user. "user_dict" contains oauth-supplied user information which is either used to initially populate the fields for a new user account, or is used to update missing fields. The "REGISTERED" label is always added to the user object if is not yet present. "ident_dict" contains the identity key, authority, and various auth-specific access and refresh tokens that will be stored with the identity. Returns the user object. """ # Create prospective user if it doesn't already exist, or else return existing user. assert 'user_id' in user_dict, user_dict assert 'authority' in ident_dict, ident_dict user = yield gen.Task(User.Query, client, user_dict['user_id'], None) identity = yield gen.Task(Identity.Query, client, ident_dict['key'], None) # Update user attributes (only if they have not yet been set). for k, v in user_dict.items(): assert k in User._REGISTER_USER_ATTRIBUTES, user_dict if getattr(user, k) is None: setattr(user, k, v) # Ensure that prospective user is registered. user.labels.add(User.REGISTERED) if rewrite_contacts: yield identity._RewriteContacts(client, timestamp) yield gen.Task(user.Update, client) # Update identity attributes. assert identity.user_id is None or identity.user_id == user.user_id, (identity, user) identity.user_id = user.user_id identity.UpdateFromKeywords(**ident_dict) yield gen.Task(identity.Update, client) raise gen.Return(user) @classmethod @gen.engine def UpdateWithSettings(cls, client, user_dict, settings_dict, callback): """Update the user's public profile, as well as any account settings specified in "settings_dict". """ # Update user profile attributes. assert all(attr_name == 'user_id' or attr_name in User._UPDATE_USER_ATTRIBUTES for attr_name in user_dict), user_dict # If any name attribute is updated, update them all, if only to None. This helps prevent # accidental divergence of name from given_name/family_name. for attr_name in ['name', 'given_name', 'family_name']: if attr_name in user_dict: user_dict.setdefault('name', None) user_dict.setdefault('given_name', None) user_dict.setdefault('family_name', None) break user = yield gen.Task(User.Query, client, user_dict['user_id'], None) user.UpdateFromKeywords(**user_dict) yield gen.Task(user.Update, client) if settings_dict: # Add keys to dict. scratch_settings_dict = deepcopy(settings_dict) scratch_settings_dict['settings_id'] = AccountSettings.ConstructSettingsId(user_dict['user_id']) scratch_settings_dict['group_name'] = AccountSettings.GROUP_NAME scratch_settings_dict['user_id'] = user_dict['user_id'] # Update any user account settings. settings = yield gen.Task(AccountSettings.QueryByUser, client, user_dict['user_id'], None, must_exist=False) if settings is None: settings = AccountSettings.CreateFromKeywords(**scratch_settings_dict) else: settings.UpdateFromKeywords(**scratch_settings_dict) yield gen.Task(settings.Update, client) callback() @classmethod @gen.coroutine def TerminateAccount(cls, client, user_id, merged_with): """Terminate the user's account by adding the "TERMINATED" flag to the labels set. If "merged_with" is not None, then the terminate is due to a merge, so set the "merged_with" field on the terminated user. """ user = yield gen.Task(User.Query, client, user_id, None) user.merged_with = merged_with user.labels.add(User.TERMINATED) yield gen.Task(user.Update, client) @classmethod def CreateUnsubscribeCookie(cls, user_id, email_type): """Create a user unsubscribe cookie that is passed as an argument to the unsubscribe handler, and which proves control of the given user id. """ unsubscribe_dict = {'user_id': user_id, 'email_type': email_type} return web.create_signed_value(secrets.GetSecret('invite_signing'), 'unsubscribe', json.dumps(unsubscribe_dict)) @classmethod def DecodeUnsubscribeCookie(cls, unsubscribe_cookie): """Decode a user unsubscribe cookie that is passed as an argument to the unsubscribe handler. Returns the unsubscribe dict containing the user_id and email_type originally passed to CreateUnsubscribeCookie. """ value = web.decode_signed_value(secrets.GetSecret('invite_signing'), 'unsubscribe', unsubscribe_cookie) return None if value is None else json.loads(value) @classmethod @gen.coroutine def TerminateAccountOperation(cls, client, user_id, merged_with=None): """Invokes User.TerminateAccount via operation execution.""" @gen.coroutine def _VisitIdentity(identity_key): """Unlink this identity from the user.""" yield Identity.UnlinkIdentityOperation(client, user_id, identity_key.hash_key) # Turn off alerts to all devices owned by the user. yield gen.Task(Device.MuteAlerts, client, user_id) # Unlink every identity attached to the user. query_expr = ('identity.user_id={id}', {'id': user_id}) yield gen.Task(Identity.VisitIndexKeys, client, query_expr, _VisitIdentity) # Add an analytics entry for this user. timestamp = Operation.GetCurrent().timestamp payload = 'terminate' if merged_with is None else 'merge=%s' % merged_with analytics = Analytics.Create(entity='us:%d' % user_id, type=Analytics.USER_TERMINATE, timestamp=timestamp, payload=payload) yield gen.Task(analytics.Update, client) # Terminate the user account. yield gen.Task(User.TerminateAccount, client, user_id, merged_with=merged_with) # Notify all friends that this user account has been terminated. yield NotificationManager.NotifyTerminateAccount(client, user_id) @classmethod @gen.engine def UpdateOperation(cls, client, callback, user_dict, settings_dict): """Invokes User.Update via operation execution.""" yield gen.Task(User.UpdateWithSettings, client, user_dict, settings_dict) timestamp = Operation.GetCurrent().timestamp yield NotificationManager.NotifyUpdateUser(client, user_dict, settings_dict, timestamp) callback()
uael/fdf
libft/src/ds/ft_du_begin.c
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* ft_du_begin.c :+: :+: :+: */ /* +:+ +:+ +:+ */ /* By: alucas- <<EMAIL>> +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2017/11/07 09:52:33 by alucas- #+# #+# */ /* Updated: 2017/11/23 09:43:11 by null ### ########.fr */ /* */ /* ************************************************************************** */ #include "libft/ds/deq.h" inline uint8_t *ft_du8_begin(t_du8 *self) { return (self->buf + self->cur); } inline uint16_t *ft_du16_begin(t_du16 *self) { return (self->buf + self->cur); } inline uint32_t *ft_du32_begin(t_du32 *self) { return (self->buf + self->cur); } inline uint64_t *ft_du64_begin(t_du64 *self) { return (self->buf + self->cur); } inline void *ft_deq_begin(t_deq *self) { return (self->buf + (self->cur * self->isz)); }
plusmancn/learn-arithmetic
arithmetic/src/main/java/cn/plusman/arithmetic/leetcode/top/top69/Top69Solution.java
package cn.plusman.arithmetic.leetcode.top.top69; /** * @author plusman * @since 2021/7/14 2:44 PM */ public interface Top69Solution { int mySqrt(int x); }
OpenHFT/Chronicle-Test-Framework
src/test/java/net/openhft/chronicle/testframework/internal/ProductionTest.java
<gh_stars>0 /* * * Copyright (c) 2006-2020, Speedment, Inc. All Rights Reserved. * * 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 net.openhft.chronicle.testframework.internal; import net.openhft.chronicle.testframework.Product; import org.junit.jupiter.api.Test; import java.util.ArrayList; import java.util.Arrays; import java.util.List; import static java.util.stream.Collectors.toList; import static org.junit.jupiter.api.Assertions.assertEquals; final class ProductionTest { @Test void product2() { final List<String> strings = Arrays.asList("A", "B", "C"); final List<Integer> integers = Arrays.asList(1, 2, 3); final List<Product.Product2<String, Integer>> actual = Product.of(strings, integers) .collect(toList()); final List<Product.Product2<String, Integer>> expected = new ArrayList<>(); for (String s : strings) { for (Integer i : integers) { expected.add(new ProductUtil.Product2Impl<>(s, i)); } } assertEquals(expected, actual); } @Test void product3() { final List<String> strings = Arrays.asList("A", "B", "C"); final List<Integer> integers = Arrays.asList(1, 2, 3); final List<Long> longs = Arrays.asList(10L, 20L, 30L); final List<Product.Product3<String, Integer, Long>> actual = Product.of(strings, integers, longs) .collect(toList()); final List<Product.Product3<String, Integer, Long>> expected = new ArrayList<>(); for (String s : strings) { for (Integer i : integers) { for (Long l:longs) { expected.add(new ProductUtil.Product3Impl<>(s, i, l)); } } } assertEquals(expected, actual); } }
CharlesPoletowin/SHU_selecting_course
src/main/Java/com/shu/db/dao/CourseDao.java
<reponame>CharlesPoletowin/SHU_selecting_course package com.shu.db.dao; import com.shu.db.entity.Course; import java.util.List; /** * Created by PoleToWin on 2019/5/1 17:50 */ public interface CourseDao { Course getCourse(String kh); List<Course> getCourseList(); List<Course> getCourseListbyYxh(String yxh); void insertCourse(Course course); void deleteCourse(String kh); void updateCourse(Course course); }
Glost/db_nets_renew_plugin
root/prj/sol/projects/renew2.5source/renew2.5/src/Gui/src/de/renew/gui/CPNDrawing.java
package de.renew.gui; import CH.ifa.draw.figures.TextFigure; import CH.ifa.draw.framework.ConnectionFigure; import CH.ifa.draw.framework.Figure; import CH.ifa.draw.framework.FigureChangeAdapter; import CH.ifa.draw.framework.FigureChangeEvent; import CH.ifa.draw.framework.FigureEnumeration; import CH.ifa.draw.framework.FigureWithID; import CH.ifa.draw.framework.FilterContainer; import CH.ifa.draw.io.SimpleFileFilter; import CH.ifa.draw.standard.AbstractFigure; import CH.ifa.draw.standard.CompositeFigure; import CH.ifa.draw.standard.StandardDrawing; import CH.ifa.draw.util.StorableInput; import CH.ifa.draw.util.StorableOutput; import de.renew.io.RNWFileFilter; import de.renew.shadow.ShadowNet; import de.renew.shadow.ShadowNetElement; import de.renew.shadow.ShadowNetSystem; import java.awt.Dimension; import java.io.IOException; import java.util.Enumeration; import java.util.HashSet; import java.util.Hashtable; import java.util.NoSuchElementException; import java.util.Vector; public class CPNDrawing extends StandardDrawing implements LayoutableDrawing { public static org.apache.log4j.Logger logger = org.apache.log4j.Logger .getLogger(CPNDrawing.class); private static FilterContainer filterContainer; /** * The shadow net of this drawing. * <p> * Transient, can be recalculated via * <code>buildShadow()</code>. * </p> */ protected transient ShadowNet shadowNet = null; /** * The figure which should be displayed as representation * for instances of this net. * @serial */ private AbstractFigure iconFigure = null; /** * Cache for all associations to * {@link FigureWithHighlight}s from their * highlight figures. * To point it out: the figure to be highlighted is * the key, and the figure with hilight is the value * of a pair in the hashtable. * <p> * Transient, will be rebuilt on deserialization. * </p> */ private transient Hashtable<Figure, Figure> hilightMap = new Hashtable<Figure, Figure>(); // ---- ID-Management ----------------------------------- /** * Caches the greatest used ID by any known figure. * Updated by <code>recomputeIDCache()</code>. * This field is transient because it is only a cache. */ private transient int maxUsedID = FigureWithID.NOID; /** * Caches used IDs in this and all subfigures. * Updated by <code>recomputeIDCache()</code>. * This field is transient because it is only a cache. */ private transient Hashtable<Integer, Figure> usedIDs = new Hashtable<Integer, Figure>(); public CPNDrawing() { super(); } public void release() { super.release(); discardShadow(); } public ShadowNet getShadow() { return shadowNet; } static CPNDrawing findDrawing(Object errorObject) { // Determine the drawing containing the errorObject. if (errorObject instanceof ShadowNetElement) { return (CPNDrawing) ((ShadowNetElement) errorObject).getNet().context; } return null; } public void discardShadow() { if (shadowNet != null) { shadowNet.discard(); shadowNet = null; } } /** * Calls the {@link ShadowHolder#buildShadow} method on all net * element figures of the given type. * * @param clazz the <code>ShadowHolder</code> subclass to use * as filter criterium */ private void buildShadow(Class<?> clazz) { FigureEnumeration k = figures(); while (k.hasMoreElements()) { Figure fig = k.nextFigure(); if (fig instanceof ShadowHolder && clazz.isInstance(fig)) { ((ShadowHolder) fig).buildShadow(shadowNet); } } } public ShadowNet buildShadow(ShadowNetSystem netSystem) { discardShadow(); shadowNet = new ShadowNet(getName(), netSystem); shadowNet.context = this; // Build shadows for declaration nodes (java-nets: only one per net!) buildShadow(DeclarationFigure.class); // Build shadows for nodes: buildShadow(NodeFigure.class); // Build shadows for connections: buildShadow(CH.ifa.draw.figures.LineConnection.class); // Build shadows for inscriptions: buildShadow(CPNTextFigure.class); return shadowNet; } public void setIconFigure(AbstractFigure iconFigure) { this.iconFigure = iconFigure; } public Figure getIconFigure() { return iconFigure; } /** * Removes a figure from the composite. * Additionally checks if the icon figure is removed. * Also checks if the ID cache has to be updated. */ public Figure remove(Figure figure) { if (figure == iconFigure) { iconFigure = null; } if (figure instanceof FigureWithID) { freeID((FigureWithID) figure); } if (figure instanceof FigureWithHighlight) { Figure hilight = ((FigureWithHighlight) figure).getHighlightFigure(); if (hilight != null) { hilightMap.remove(hilight); } } Figure result = super.remove(figure); if (figure instanceof CompositeFigure) { recomputeIDCache(); } return result; } // add(Figure) is handled somewhere below. /** * Writes the contained figures to the StorableOutput. */ public void write(StorableOutput dw) { super.write(dw); dw.writeStorable(iconFigure); } /** * Reads the contained figures from StorableInput. */ public void read(StorableInput dr) throws IOException { super.read(dr); if (dr.getVersion() >= 2) { try { iconFigure = (AbstractFigure) dr.readStorable(); } catch (IOException e) { logger.error("Icon expected."); logger.debug("Icon expected.", e); } if (dr.getVersion() >= 3) { recomputeHilightMap(); } } recomputeIDCache(); } synchronized public void fillInGraph(GraphLayout layout) { FigureEnumeration k = figures(); while (k.hasMoreElements()) { Figure f = k.nextFigure(); // if (f instanceof TransitionFigure || f instanceof PlaceFigure) { if (f instanceof TransitionFigure || f instanceof PlaceFigure || f instanceof TextFigure && ((TextFigure) f).parent() == null) { layout.addNode(f); // } else if (f instanceof ArcConnection) { } else if (f instanceof ConnectionFigure) { layout.addEdge((ConnectionFigure) f, 20); } } } void setHighlightFigure(final FigureWithHighlight node, final Figure fig) { Figure oldHighlight = node.getHighlightFigure(); if (oldHighlight != null) { hilightMap.remove(oldHighlight); } node.setHighlightFigure(fig); if (fig != null) { hilightMap.put(fig, node); fig.addFigureChangeListener(new FigureChangeAdapter() { public void figureRemoved(FigureChangeEvent e) { setHighlightFigure(node, null); } }); node.addFigureChangeListener(new FigureChangeAdapter() { public void figureRemoved(FigureChangeEvent e) { hilightMap.remove(fig); } }); } } FigureWithHighlight getFigureForHighlight(Figure hilightFig) { try { return (FigureWithHighlight) hilightMap.get(hilightFig); } catch (NoSuchElementException e) { return null; } } public Dimension defaultSize() { return new Dimension(535, 788); } /** * Deserialization method, behaves like default readObject * method except restoring default values for transient * fields. */ private void readObject(java.io.ObjectInputStream in) throws IOException, ClassNotFoundException { in.defaultReadObject(); // The serialization mechanism constructs the object // with a less-than-no-arg-constructor, so that the // default values for transient fields have to be // reinitialized manually. hilightMap = new Hashtable<Figure, Figure>(); maxUsedID = FigureWithID.NOID; usedIDs = new Hashtable<Integer, Figure>(); // For full functionality we need to recompute some // tables. recomputeIDCache(); recomputeHilightMap(); } /** * Recomputes the <code>hilightMap</code> by examining * all figures. */ private void recomputeHilightMap() { hilightMap.clear(); addToHilightMap(this); } /** * Adds the highlight figures of all figures contained in the * given <code>CompositeFigure</code> to the <code>hilightMap</code>. * Used by {@link #recomputeHilightMap}. * * @param container CompositeFigure to scan for figures * with hilights. */ private void addToHilightMap(CompositeFigure container) { FigureEnumeration figenumeration = container.figures(); while (figenumeration.hasMoreElements()) { Figure fig = figenumeration.nextFigure(); if (fig instanceof FigureWithHighlight) { Figure hilight = ((FigureWithHighlight) fig).getHighlightFigure(); if (hilight != null) { // logger.debug("Highlight for "+fig+" restored!"); hilightMap.put(hilight, fig); } } if (fig instanceof CompositeFigure) { addToHilightMap((CompositeFigure) fig); } } } public String getWindowCategory() { return "Nets"; } /** * Adds a figure to the list of figures * (as the superclass does). * * If the figure implements the interface<code> * CH.ifa.draw.framework.FigureWithID</code>, checks * its ID and assigns a new one if needed. */ public Figure add(Figure figure) { // The ID check has to be done before the // figure is added to the list to avoid // collision of the figure with itself. // If figure is capable of holding an ID, // check its ID and assign a new one, if // needed. if (figure instanceof FigureWithID) { checkAndAssignID((FigureWithID) figure); // Now the figure can be added to the list. } Figure result = super.add(figure); // If the figure can hilight other figures, put // its highlight figure into the map (if there // is any). if (figure instanceof FigureWithHighlight) { Figure hilight = ((FigureWithHighlight) figure).getHighlightFigure(); if (hilight != null) { hilightMap.put(hilight, figure); } } // If a CompositeFigure is added, it may // contain a lot of other figures. if (figure instanceof CompositeFigure) { recomputeIDCache(); recomputeHilightMap(); } return result; } // remove(...) is handled somewhere above. /** * Checks the figure if it has already a * legal ID. If neccessary, generates new * unique ID and assigns it. */ private void checkAndAssignID(FigureWithID figure) { int oldID = figure.getID(); int newID = oldID; FigureWithID inCache = (FigureWithID) usedIDs.get(new Integer(oldID)); if ((inCache != null) && (inCache != figure)) { // The old ID is already used by another figure, // so reset it temporarily to NOID. newID = FigureWithID.NOID; } if (newID == FigureWithID.NOID) { newID = newUniqueID(); figure.setID(newID); } usedIDs.put(new Integer(newID), figure); } /** * Tries to assign a given id to the figure. */ public void assignID(FigureWithID figure, int id) { // check if the new id can be given to the figure: FigureWithID inCache = (FigureWithID) usedIDs.get(new Integer(id)); if ((inCache != null) && (inCache != figure)) { throw new IllegalArgumentException("The id is already in use!"); } // remove old mapping from cache: usedIDs.remove(new Integer(figure.getID())); // set new id and add to cache: figure.setID(id); usedIDs.put(new Integer(id), figure); } /** * Frees up the ID used by the given figure. */ private void freeID(FigureWithID figure) { // Check if the ID was really cached // before freeing it up. Integer usedID = new Integer(figure.getID()); if (usedIDs.get(usedID) == figure) { usedIDs.remove(usedID); } } /** * Generates a new ID not used in the list of figures. * @see CH.ifa.draw.framework.FigureWithID */ private int newUniqueID() { // If the cache is uninitialized, // recompute its value. // If the greatest used ID is still equal to // NOID afterwards, then there is no figure. if (maxUsedID == FigureWithID.NOID) { recomputeIDCache(); } maxUsedID++; if (usedIDs.containsKey(new Integer(maxUsedID))) { boolean resetOnce = false; while (usedIDs.containsKey(new Integer(maxUsedID))) { maxUsedID++; if (maxUsedID == Integer.MIN_VALUE) { maxUsedID = 1; if (resetOnce) { throw new RuntimeException("Maximum numnber of figures exeeded."); } else { resetOnce = true; } } } } return maxUsedID; } /** * Recomputes the ID cache (maxUsedID and usedIDs) * and eliminates IDs used more than once. */ protected void recomputeIDCache() { // To ensure that no ID will be reassigned // even after it has been freed, do never // reset the greatest ID cache. // However, after closing the drawing, this // value will be reset anyway... // maxUsedID = FigureWithID.NOID; Vector<Figure> offendingFigures = new Vector<Figure>(); usedIDs.clear(); addToIDCache(this, offendingFigures); Enumeration<Figure> figureList = offendingFigures.elements(); while (figureList.hasMoreElements()) { checkAndAssignID((FigureWithID) figureList.nextElement()); } } /** * Do not call this method directly, use * <code>recomputeIDCache()</code> instead. * @param container CompositeFigure to scan for figures with ID. * @param offendingFigures Collects figures with illegal IDs. */ private void addToIDCache(CompositeFigure container, Vector<Figure> offendingFigures) { FigureEnumeration knownFigures = container.figures(); Figure figure; int usedID; FigureWithID inCache; // Iterate through all known Figures and update the // greatest seen ID. // Also update the Hashtable of used IDs and check if // some ID is already used by some other figure. // If there are CompositeFigures contained in the // drawing (like GroupFigures), recurse into them. while (knownFigures.hasMoreElements()) { figure = knownFigures.nextFigure(); if (figure instanceof FigureWithID) { usedID = ((FigureWithID) figure).getID(); inCache = (FigureWithID) usedIDs.get(new Integer(usedID)); if ((inCache == null) || (inCache == figure)) { usedIDs.put(new Integer(usedID), figure); if (usedID > maxUsedID) { maxUsedID = usedID; } } else { // An ID is used twice.This will be silently corrected // by the caller of this method. // logger.debug("ID used more than once: "+usedID); offendingFigures.addElement(figure); } } else if (figure instanceof CompositeFigure) { addToIDCache((CompositeFigure) figure, offendingFigures); } } } /** * Returns the FigureWithID currently assigned to * the given ID. If no figure is assigned to that * ID, returns <code>null</code>. * <p> * It is possible that the returned figure is not * contained in the <code>figures()</code> enumeration. * Then it was found in some CompositeFigure contained * in the enumeration. * </p> * @see CH.ifa.draw.framework.FigureWithID */ public FigureWithID getFigureWithID(int id) { return (FigureWithID) usedIDs.get(new Integer(id)); } //------------------------------------------------------------------------------ static public FilterContainer getFilterContainer() { if (filterContainer == null) { return new FilterContainer(new RNWFileFilter()); } else { return filterContainer; } } public SimpleFileFilter getDefaultFileFilter() { return getFilterContainer().getDefaultFileFilter(); } public HashSet<SimpleFileFilter> getImportFileFilters() { return getFilterContainer().getImportFileFilters(); } public HashSet<SimpleFileFilter> getExportFileFilters() { return getFilterContainer().getExportFileFilters(); } /* (non-Javadoc) * @see CH.ifa.draw.framework.Drawing#getDefaultExtension() */ public String getDefaultExtension() { return getDefaultFileFilter().getExtension(); } }
titusfortner/watirmark
lib/watirmark/models/factory.rb
require_relative 'cucumber_helper' require_relative 'default_values' require_relative 'factory_methods' require_relative 'factory_method_generators' require_relative 'debug_methods' module Watirmark module Model class Factory extend FactoryMethods include CucumberHelper include DebugMethods include FactoryMethodGenerators attr_accessor :defaults, :model_name, :models, :parent, :children, :model_type attr_reader :keywords def marshal_dump [@keywords, @model_name, @models, @parent, @children, @model_type, self.to_h] end def marshal_load(obj) keyword_values = obj.pop @keywords, @model_name, @models, @parent, @children, @model_type = obj update keyword_values end def initialize(params={}) @params = params @model_type = self.class.model_type_name @search = self.class.search || Proc.new{nil} @keywords = self.class.keys.dup || [] @children = self.class.children.dup.map(&:new) set_model_name set_default_values create_model_getters_and_setters set_initial_values Watirmark.logger.info inspect end def uuid @uuid ||= (Watirmark::Configuration.instance.uuid || UUID.new.generate(:compact)[0..9]).to_s end def hash_id(size = nil, type = :hex) size = size || Watirmark::Configuration.instance.hash_id_length || 8 seed = Watirmark::Configuration.instance.hash_id_seed || "Watirmark Default Seed" @hash_id ||= generate_hash_id seed, size, type end def strip_equals_from_method_name(method) method.to_s.delete('=').to_sym end # The search_term, used for a controller's search can be defined in this model # or will look in a parent's model. This allows us to define it once for a composed model def search_term instance_eval(&@search) || (parent.search_term if parent) end def add_model(model) @children << model create_child_methods Watirmark.logger.info "Added Model #{model.inspect} to #{model_name || model_class_name}" return self end def find(model_class) return self if self.kind_of? model_class @children.each do |m| return m if m.model_type == model_class found_model = m.find model_class return found_model if found_model end nil end def inspect model_friendly_name = @model_name ? "#@model_name: " : nil model_details = " #{to_h}" unless to_h.empty? included_models = "\n #{@children.map(&:inspect).join("\n ")}" unless @children.empty? "#{model_friendly_name}#{model_class_name}#{model_details}#{included_models}" end def model_class_name name = self.class.inspect.to_s name = self.class.superclass.to_s if name.to_s =~ /Class/ name = 'Model' if name.to_s =~ /Module/ name.sub!(/.+::/,'') name end def includes? hash hash.each_pair { |key, value| return false unless send("#{key}") == value } true end # Update the model using the provided hash def update hash remove_empty_entries hash hash.each_pair { |key, value| send "#{key}=", value } self end alias :has :update # Update the model using the provided hash but only if exists (TODO: may not be needed any more) def update_existing_members hash remove_empty_entries hash hash.each_pair { |key, value| send "#{key}=", value if respond_to? "#{key}=".to_sym } self end def remove_empty_entries hash hash.delete_if {|k| k.nil? || k == ':' || k =~ /^\s+$/ || k.empty?} end def to_h h = {} @keywords.each do |key| begin name = key value = send(key) if value.kind_of?(Proc) h[name] = instance_eval(&value) unless value.nil? else h[name] = value unless value.nil? end rescue NoMethodError h[name] = "[defined at runtime]" end end h end def unique_instance_name class_name = self.class.name[/([^\:]+)Model$/i,1] model_name_exists = model_name.nil? ? false : (not model_name.empty?) unique_name = model_name_exists ? model_name : class_name.downcase unique_name_with_uuid = unique_name + "_" + uuid end private def set_model_name if @params[:model_name] @model_name = @params[:model_name] @params.delete(:model_name) end end def create_model_getters_and_setters create_keyword_methods create_child_methods end def set_default_values @defaults = self.class.default.dup @traits = self.class.included_traits || [] include_defaults_from_traits @traits end def set_initial_values update @params add_debug_overrides end def include_defaults_from_traits(traits) traits.each do |trait_name| trait = Watirmark::Model::Traits.instance[trait_name] trait.defaults.each {|k, v| @defaults[k] = v unless @defaults.key?(k)} trait.traits.each {|t| include_defaults_from_traits([t])} end end def method_name model model.model_class_name.to_s.sub(/Model$/, '').underscore end def generate_hash_id(seed, size=8, type = :hex) seed_int = seed.scan(/./).inject(1) { |product, chr| product * chr.ord } prng = Random.new(seed_int) if type == :alpha o = ('a'..'z').to_a + ('A'..'Z').to_a + (0..9).to_a else #:hex o = ('a'..'f').to_a + (0..9).to_a end (0...size.to_i).map { o.sample(random: prng) }.join end end end end
Titzi90/hpx
examples/interpolate1d/interpolate1d/dimension.cpp
// Copyright (c) 2007-2012 <NAME> // // Distributed under the Boost Software License, Version 1.0. (See accompanying // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) #include <hpx/hpx_fwd.hpp> #include <hpx/util/portable_binary_iarchive.hpp> #include <hpx/util/portable_binary_oarchive.hpp> #include "dimension.hpp" namespace boost { namespace serialization { /////////////////////////////////////////////////////////////////////////////// // implement the serialization functions template <typename Archive> void serialize(Archive& ar, interpolate1d::dimension& dim, unsigned int const) { ar & dim.offset_ & dim.count_ & dim.size_; } /////////////////////////////////////////////////////////////////////////// // explicit instantiation for the correct archive types template HPX_COMPONENT_EXPORT void serialize(hpx::util::portable_binary_iarchive&, interpolate1d::dimension&, unsigned int const); template HPX_COMPONENT_EXPORT void serialize(hpx::util::portable_binary_oarchive&, interpolate1d::dimension&, unsigned int const); }}
npocmaka/Windows-Server-2003
windows/advcore/ctf/aimm1.2/win32/compstr.cpp
/*++ Copyright (c) 1985 - 1999, Microsoft Corporation Module Name: compstr.cpp Abstract: This file implements the CCompStrFactory Class. Author: Revision History: Notes: --*/ #include "private.h" #include "compstr.h" #include "a_wrappers.h" HRESULT CCompStrFactory::CreateCompositionString( CWCompString* CompStr, CWCompAttribute* CompAttr, CWCompClause* CompClause, CWCompTfGuidAtom* CompGuid, CWCompString* CompReadStr, CWCompAttribute* CompReadAttr, CWCompClause* CompReadClause, CWCompString* ResultStr, CWCompClause* ResultClause, CWCompString* ResultReadStr, CWCompClause* ResultReadClause ) { DWORD dwCompSize = (CompStr ? Align(CompStr->GetSize() * sizeof(WCHAR)) : 0) + (CompAttr ? Align(CompAttr->GetSize() * sizeof(BYTE)) : 0) + (CompClause ? Align(CompClause->GetSize() * sizeof(DWORD)) : 0) + (CompReadStr ? Align(CompReadStr->GetSize() * sizeof(WCHAR)) : 0) + (CompReadAttr ? Align(CompReadAttr->GetSize() * sizeof(BYTE)) : 0) + (CompReadClause ? Align(CompReadClause->GetSize() * sizeof(DWORD)) : 0) + (ResultStr ? Align(ResultStr->GetSize() * sizeof(WCHAR)) : 0) + (ResultClause ? Align(ResultClause->GetSize() * sizeof(DWORD)) : 0) + (ResultReadStr ? Align(ResultReadStr->GetSize() * sizeof(WCHAR)) : 0) + (ResultReadClause ? Align(ResultReadClause->GetSize() * sizeof(DWORD)) : 0) + (CompGuid ? Align(CompGuid->GetSize() * sizeof(TfGuidAtom)) : 0) + // COMPSTRING_AIMM12->dwTfGuidAtom (CompGuid && CompAttr ? Align(CompAttr->GetSize() * sizeof(BYTE)) : 0); // COMPSTRING_AIMM12->dwGuidMapAttr #ifdef CICERO_4678 // // This is another workaround instead of dimm\imewnd.cpp. // Even subclass window hook off, AIMM won't resize hCompStr if dwCompSize is zero. // return (dwCompSize ? _CreateCompositionString(dwCompSize) : S_OK); #else return _CreateCompositionString(dwCompSize); #endif } HRESULT CCompStrFactory::CreateCompositionString( CWInterimString* InterimStr ) { DWORD dwCompSize = (InterimStr ? Align(InterimStr->GetSize() * sizeof(WCHAR)) : 0) + Align(sizeof(WCHAR)) + // Interim char Align(sizeof(BYTE)); // Interim attr return _CreateCompositionString(dwCompSize); } HRESULT CCompStrFactory::_CreateCompositionString( DWORD dwCompSize ) /*+++ Return Value: Returns S_FALSE, dwCompSize is zero. Returns S_OK, dwCompSize is valid size. ---*/ { IMTLS *ptls = IMTLS_GetOrAlloc(); HRESULT hr = (dwCompSize != 0 ? S_OK : S_FALSE); dwCompSize += sizeof(COMPOSITIONSTRING_AIMM12); if (m_himcc == NULL) { // // First creation. Let's initialize it now // m_himcc = ImmCreateIMCC(ptls, dwCompSize); if (m_himcc != NULL) { m_hr = _LockIMCC(m_himcc, (void**)&m_pcomp); } } else if (ImmGetIMCCSize(ptls, m_himcc) != dwCompSize) { // // If already have m_himcc, then recreate it. // if (m_pcomp) { _UnlockIMCC(m_himcc); } HIMCC hMem; if ((hMem = ImmReSizeIMCC(ptls, m_himcc, dwCompSize)) != NULL) { m_himcc = hMem; } else { ImmDestroyIMCC(ptls, m_himcc); m_himcc = ImmCreateIMCC(ptls, dwCompSize); } if (m_himcc != NULL) { m_hr = _LockIMCC(m_himcc, (void**)&m_pcomp); } } if (FAILED(m_hr)) return m_hr; if (m_himcc == NULL) return E_OUTOFMEMORY; memset(m_pcomp, 0, dwCompSize); // clear buffer with zero. m_pcomp->CompStr.dwSize = dwCompSize; // set buffer size. m_pEndOfData = (BYTE*)m_pcomp + sizeof(COMPOSITIONSTRING_AIMM12); // set end of the data pointer. return hr; }
sping/ractive
src/view/items/element/binding/NumericBinding.js
import GenericBinding from './GenericBinding'; export default class NumericBinding extends GenericBinding { getInitialValue () { return undefined; } getValue () { const value = parseFloat( this.node.value ); return isNaN( value ) ? undefined : value; } setFromNode( node ) { const value = parseFloat( node.value ); if ( !isNaN( value ) ) this.model.set( value ); } }
lastaflute/lastaflute-example-maihama
maihama-showbase/src/main/java/org/docksidestage/app/web/products/purchases/assist/PurchasesCrudAssist.java
/* * Copyright 2015-2018 the original author or 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 org.docksidestage.app.web.products.purchases.assist; import java.util.List; import javax.annotation.Resource; import org.docksidestage.app.web.products.purchases.PurchasesSearchForm; import org.docksidestage.dbflute.exbhv.PurchaseBhv; import org.docksidestage.dbflute.exentity.Purchase; /** * @author jflute */ public class PurchasesCrudAssist { // =================================================================================== // Attribute // ========= @Resource private PurchaseBhv purchaseBhv; // =================================================================================== // Select // ====== public List<Purchase> selectPurchaseList(Integer productId, PurchasesSearchForm form) { return purchaseBhv.selectList(cb -> { cb.setupSelect_Member(); cb.setupSelect_Product(); cb.query().setProductId_Equal(productId); cb.query().addOrderBy_PurchaseDatetime_Desc(); }); } public Purchase selectPurchaseById(Integer productId, Long purchaseId) { return purchaseBhv.selectEntity(cb -> { cb.setupSelect_Member(); cb.setupSelect_Product(); cb.query().setProductId_Equal(productId); // #for_now jflute needed? (2021/05/15) cb.query().setPurchaseId_Equal(purchaseId); }).get(); } }
zohassadar/netdisc
netdisc/discover/looper.py
<filename>netdisc/discover/looper.py """ S = Starting Host N = Neighbor (discovered host [S1, S2, S3] -> _hopper """ from __future__ import annotations import logging logging.basicConfig(level=logging.DEBUG) import collections import dataclasses import ipaddress import logging import queue from netdisc.tools import pandor from netdisc.base import abstract, device_base from netdisc.discover import authen, worker from netdisc.tools import interactive logger = logging.getLogger(__name__) logger.addHandler(logging.NullHandler()) @dataclasses.dataclass class PendingDevice: host: str hostname: str = None sysinfo: str = None auth_methods: authen.AuthMethodList = None extra: dict = dataclasses.field(default_factory=dict) def __post_init__(self): self.failure_reasons: list[str] = [] self.device: device_base.Device = device_base.Device() self.dumped_device: dict[str, str | int | bool | list] = {} @dataclasses.dataclass class DiscoveryRunner: topology: abstract.TopologyBase = None hostlist: list = dataclasses.field( default_factory=list, ) auth_methods: authen.AuthMethodList = dataclasses.field( default_factory=authen.AuthMethodList, ) discovery_q: queue.Queue = dataclasses.field( default_factory=queue.Queue, ) discovered_q: queue.Queue = dataclasses.field( default_factory=queue.Queue, ) filter: pandor.FilterAbstract = None interactive: interactive.InteractiveNeighborFilter = None extra: dict = dataclasses.field(default_factory=dict) # outputs: list[abstract.OutputBase] loop_forever: bool = False max_loops: int = 60 loop_sleep: int = 1 def loop(self): while self._running(): self._check_new() self._check_finished() def __post_init__(self): logger.debug("Initializing looper") # Devices awaiting discovery self._pending: dict[str, PendingDevice] = {} # Container of IP addresses confirmed to have been visited. self._known_hosts: set[str] = set() # Devices waiting to be discovered self._hopper: collections.deque[PendingDevice] = collections.deque() # Start counter for idle cycles self._idle_count = 0 # Run reset to populate self._hopper with self.hostlist self._reset() def _not_dead(self): """Reset the dead timer""" logger.debug("we're still alive") self._idle_count = 0 def _reset(self): """Reset the state of the loop Used at the beginning to fill _hopper Used at the end of the loop to fill _hopper with the same list as the starting list when loop_forever is used """ _starting_hosts = [] for host in self.hostlist: logger.debug("Adding start host: %s", host) _pending = PendingDevice( host=host, auth_methods=self.auth_methods.copy(), extra=self.extra, ) _starting_hosts.append(_pending) logger.debug("Resetting looper with %s starting hosts", len(_starting_hosts)) self._hopper.extend(_starting_hosts) self._known_hosts = set() def _running(self) -> bool: """Check both queue lengths and the _hopper length Reset if all are empty and loop_forever is enabled """ if self._idle_count > self.max_loops: logger.error("Exceeded max loops %s", self.max_loops) return False self._idle_count += 1 _pending_l = len(self._pending) _discovery_l = self.discovery_q.qsize() _discovered_l = self.discovered_q.qsize() _hopper_l = len(self._hopper) _result = bool(_pending_l + _discovery_l + _discovered_l + _hopper_l) logger.info( "Q Stats: Idle: %s Pending: %s, Pre: %s Post: %s Hopper: %s Completed: %s Successful: %s", self._idle_count, _pending_l, _discovery_l, _discovered_l, _hopper_l, self.topology.total, self.topology.total_successful, ) if not _result and self.loop_forever: logger.info("Discovery complete. Starting over.") _result = True self._reset() elif not _result: logger.warning("Discovery complete") return _result def _add_task_request(self, pending: PendingDevice): """If an authentication method is available, put in the queue If not, _send_to_topology """ logger.debug( "authentication_failure = %s", pending.device.authentication_failure ) auth = pending.auth_methods.next(pending.device.authentication_failure) if not auth: logger.error( "Exhauted Authentication Methods %s %s", pending.host, pending.hostname ) self._send_to_topology(pending) return logger.info("TaskRequest: %s %s", pending.host, pending.hostname) task = worker.TaskRequest( host=pending.host, proto=str(auth.proto), kwargs=auth.kwargs, hostname=pending.hostname, sysinfo=pending.sysinfo, extra=pending.extra, ) self.discovery_q.put(tuple(task)) def _check_new(self): """Empty _hopper and send to _add_task_request ignore IPs that have been seen """ while self._hopper: self._not_dead() _pending = self._hopper.popleft() _host = _pending.host if _host in self._known_hosts: logger.info(f"Skipping %s. Already visited", _host) continue self._known_hosts.add(_host) self._pending[_host] = _pending logger.debug( "Adding to discovery queue: %s %s", _pending.host, _pending.hostname, ) self._add_task_request(_pending) def _check_finished(self): """Check and see if anything has come back. Send to _add_task_request if it failed _send_to_topology if it succeeded """ try: response = self.discovered_q.get(timeout=self.loop_sleep) except queue.Empty: return self._not_dead() _response = worker.TaskResponse(*response) _pending = self._pending[_response.host] logger.info( "Popped from the queue %s", _response.host, ) _pending.dumped_device = _response.dumped _pending.device.load_partial(_pending.dumped_device) if _pending.device.failed: _pending.failure_reasons.append(_pending.device.failure_reason) logger.warning( "Device failed. Sending back through: %s %s", _pending.host, _pending.hostname, ) self._add_task_request(_pending) else: logger.info( "Device succeeded. Adding to topology: %s %s", _pending.host, _pending.hostname, ) self._send_to_topology(_pending) def _extract_neighbors(self, pending): logger.info("extracting neighbors from %s", pending.host) _pre_filtered = [ neighbor for neighbor in pending.device.neighbors if self.filter.filter(neighbor) ] _filtered = _pre_filtered if self.interactive: _filtered = self.interactive.filter(pending.device, _pre_filtered) for neighbor in _filtered: if not neighbor.ip: continue try: ipaddress.IPv4Address(neighbor.ip) except Exception as exc: logger.critical("%s %s", type(exc), str(exc)) continue _pending = PendingDevice( auth_methods=self.auth_methods.copy(), host=neighbor.ip, hostname=neighbor.hostname, sysinfo=neighbor.sysinfo, extra=self.extra, ) self._hopper.append(_pending) def _extract_host_addresses(self, pending): for ip_address in pending.device.ip_addresses: self._known_hosts.add(ip_address.address) def _send_to_topology(self, pending: PendingDevice): """Extract neighbors and send device to topology Pop from _pending dictionary """ pending.device.load(pending.dumped_device) pending.device.failure_history = ", ".join(pending.failure_reasons) self._extract_neighbors(pending) self._extract_host_addresses(pending) self._pending.pop(pending.host) self.topology.update_device(pending.device)
mrjj/dicker
src/constants.js
<gh_stars>1-10 /** * @fileOverview Constants */ /** * @constant TASK_STATUS {Object} * @type {{DONE: string, FAILED: string, RUNNING: string, SKIPPED: string, PENDING: string}} */ const TASK_STATUS = { SKIPPED: 'SKIPPED', PENDING: 'PENDING', RUNNING: 'RUNNING', DONE: 'DONE', FAILED: 'FAILED', UNKNOWN: 'UNKNOWN', }; const TASK_TYPES = { CONTROL: 'CONTROL', DOCKER_BUILD: 'DOCKER_BUILD', DOCKER_PUSH: 'DOCKER_PUSH', COMMAND: 'COMMAND', }; const DEFAULT_TASK_TYPE = TASK_TYPES.DOCKER_BUILD; const DEFAULT_TASK_STATUS = TASK_STATUS.PENDING; const DEAD_TASK_NAME = '$_dead_$'; /** * @constant ROOT_TASK_NAME * @type {string} */ const ROOT_TASK = { type: TASK_TYPES.CONTROL, dependsOn: [], task: '$_root_task_$', description: 'Root task (will not be executed)', skip: false, status: DEFAULT_TASK_STATUS, }; /** * @constant DEFAULT_MANIFEST_PATH * @type {string} */ const DEFAULT_MANIFEST_PATH = './build.json'; /** * @constant DEFAULT_IMAGE_NAME * @type {string} */ const DEFAULT_IMAGE_NAME = 'latest'; /** * @constant FACES * * - HAPPY `(^‿^)` * - DEAD `[X.X]` * - DEAD_FOR_28_DAYS `[X~x]` * - NDE `[x.x]` * - SURPRISED `[O.O]` * - CALMED_DOWN `[o.o]` * - DONT_GIVE ` -.- ` * - DIZZY ` ~_~ ` * - NOT_ME ` ._. ` * - HIDING ` _._ ` * - INSPECTOR: `[-.<]` `[>.<]` `[>.-]` * - YES_BUT `[ ! ]` */ const FACES = { HAPPY: '(^‿^)', DEAD: '{X.X}', DEAD_FOR_28_DAYS: '{X~x}', NDE: '{x.x}', AWAKENING: '[-.o]', SURPRISED: '[O.O]', CALMED_DOWN: '[o.o]', DONT_GIVE: [' -.- ', ' -.~ ', ' ~.~ ', ' ~.- '], DASH: ' - ', DIZZY: '[~_~]', NOT_ME: ' -.- ', HIDING: ' _._ ', INSPECTOR: ['[-.<]', '[-.o]', '[o.O]', '[o.°]', '[~.o]', '[-‿<]'], YES_BUT: '( ! )', }; const TASK_STATUS_TO_FACE = { [TASK_STATUS.SKIPPED]: FACES.NOT_ME, [TASK_STATUS.PENDING]: FACES.AWAKENING, [TASK_STATUS.RUNNING]: FACES.SURPRISED, [TASK_STATUS.DONE]: FACES.HAPPY, [TASK_STATUS.FAILED]: FACES.DEAD, [TASK_STATUS.UNKNOWN]: FACES.NDE, }; const TASK_NAME_MAX_LEN = 32; const TASK_STATUS_MAX_LEN = Object.keys(TASK_STATUS) .map(ts => ts.length) .sort((a, b) => (b - a))[0]; const TASK_TYPE_MAX_LEN = Object.keys(TASK_TYPES) .map(ts => ts.length) .sort((a, b) => (b - a))[0]; const SEP = `${'-'.repeat(16)}`; const DEFAULT_DOCKER_PUBLIC_REGISTRY = 'docker.io/'; const DEFAULT_NAME = 'dicker-default'; const LEGACY_DEFAULT_DOMAIN = 'index.docker.io'; const DEFAULT_DOMAIN = 'docker.io'; const OFFICIAL_REPO_NAME = 'library'; const DEFAULT_TAG = 'latest'; const PATH_SEPARATOR = '/'; const LOCALHOST = 'localhost'; const POSSIBLE_EXTENSIONS = ['.json', '.yml', '.yaml']; const DEFAULT_DOCKERFILE_NAME = 'Dockerfile'; const DEFAULT_ENCODING = 'utf8'; const DOCKER_ARGS_DEFAULT = ['--force-rm']; const DEFAULT_DIGEST_ALGORITHM = 'sha256'; const DEFAULT_REFERENCE = { domain: DEFAULT_DOMAIN, repository: OFFICIAL_REPO_NAME, tag: DEFAULT_TAG, digestAlgorithm: DEFAULT_DIGEST_ALGORITHM, }; module.exports = { DEAD_TASK_NAME, DOCKER_ARGS_DEFAULT, DEFAULT_REFERENCE, DEFAULT_DOCKER_PUBLIC_REGISTRY, DEFAULT_DOCKERFILE_NAME, DEFAULT_DOMAIN, DEFAULT_ENCODING, DEFAULT_IMAGE_NAME, DEFAULT_MANIFEST_PATH, DEFAULT_NAME, DEFAULT_TAG, DEFAULT_TASK_STATUS, DEFAULT_TASK_TYPE, FACES, LEGACY_DEFAULT_DOMAIN, LOCALHOST, OFFICIAL_REPO_NAME, PATH_SEPARATOR, POSSIBLE_EXTENSIONS, ROOT_TASK, SEP, TASK_NAME_MAX_LEN, TASK_STATUS, TASK_STATUS_MAX_LEN, TASK_STATUS_TO_FACE, TASK_TYPE_MAX_LEN, TASK_TYPES, };
jjzhang166/minerva
scripts/modelconvertor/caffe2minerva.py
#!/usr/bin/env python import os import sys, argparse import owl from owl.net.caffe import * from google.protobuf import text_format import numpy as np import owl import subprocess class Caffe2MinervaConvertor: ''' Class to convert Caffe's caffemodel into numpy array files. Minerva use numpy array files to store and save model snapshots. :ivar str model_file: Caffe's caffemodel :ivar str weightdir: directory to save numpy-array models :ivar int snapshot: snapshot index ''' def __init__(self, model_file, weightdir, snapshot): netparam = NetParameter() layerparam = V1LayerParameter() with open(model_file, 'rb') as f: netparam.ParseFromString(f.read()) cmd = 'mkdir %s' % (weightdir) res = subprocess.call(cmd, shell=True) cmd = 'mkdir %s/snapshot%d' % (weightdir, snapshot) res = subprocess.call(cmd, shell=True) curweights = 0 for i in range(len(netparam.layers)): #print '%d %d' % (i, curweights) if hasattr(netparam.layers[i], 'blobs') and len(netparam.layers[i].blobs) == 2: layername = netparam.layers[i].name layername = layername.replace("/","_") filename = '%s/snapshot%d/%s_weights.dat' % (weightdir, snapshot, layername) print filename if netparam.layers[i].type == layerparam.LayerType.Value('CONVOLUTION'): num_output = netparam.layers[i].convolution_param.num_output kernelsize = netparam.layers[i].convolution_param.kernel_size orifilters = np.array(netparam.layers[i].blobs[0].data, dtype=np.float32) channels = np.shape(orifilters)[0] / num_output / kernelsize / kernelsize orifilters = orifilters.reshape([num_output, channels, kernelsize, kernelsize]) newfilters = np.zeros(np.shape(orifilters), dtype=np.float32) for outidx in range(num_output): for chaidx in range(channels): newfilters[outidx, chaidx, :, :] = np.rot90(orifilters[outidx, chaidx, :,:],2) newfilters.reshape(np.prod(np.shape(newfilters)[0:4])).tofile(filename) else: num_output = netparam.layers[i].inner_product_param.num_output input_dim = np.shape(np.array(netparam.layers[i].blobs[0].data, dtype=np.float32))[0] / num_output theweight = np.transpose(np.array(netparam.layers[i].blobs[0].data, dtype=np.float32).reshape([num_output, input_dim])) theweight.tofile(filename) filename = '%s/snapshot%d/%s_bias.dat' % (weightdir, snapshot, layername) print filename np.array(netparam.layers[i].blobs[1].data, dtype=np.float32).tofile(filename) if __name__ == "__main__": # parse command line arguments parser = argparse.ArgumentParser() parser.add_argument('caffe_model', help='caffe model to be converted') parser.add_argument('minerva_model_dir', help='minerva model dir') parser.add_argument('snapshot', help='the snapshot idx to be saved as', type=int, default=0) (args, remain) = parser.parse_known_args() Caffe2MinervaConvertor(args.caffe_model, args.minerva_model_dir, args.snapshot)
anonymous-authorss/DS-Pipeline
notebooks/research-25/training-mask-r-cnn-to-be-a-fashionista-lb-0-07.py
# coding: utf-8 # Welcome to the world where fashion meets computer vision! This is a starter kernel that applies Mask R-CNN with COCO pretrained weights to the task of [iMaterialist (Fashion) 2019 at FGVC6](https://www.kaggle.com/c/imaterialist-fashion-2019-FGVC6). # In[1]: import os import gc import sys import json import glob import random from pathlib import Path import cv2 import numpy as np import pandas as pd import matplotlib.pyplot as plt import itertools from tqdm import tqdm from imgaug import augmenters as iaa from sklearn.model_selection import StratifiedKFold, KFold # In[2]: DATA_DIR = Path('/kaggle/input') ROOT_DIR = Path('/kaggle/working') # For demonstration purpose, the classification ignores attributes (only categories), # and the image size is set to 512, which is the same as the size of submission masks NUM_CATS = 46 IMAGE_SIZE = 512 # # Dowload Libraries and Pretrained Weights # In[3]: get_ipython().system('git clone https://www.github.com/matterport/Mask_RCNN.git') os.chdir('Mask_RCNN') get_ipython().system('rm -rf .git # to prevent an error when the kernel is committed') get_ipython().system('rm -rf images assets # to prevent displaying images at the bottom of a kernel') # In[4]: sys.path.append(ROOT_DIR/'Mask_RCNN') from mrcnn.config import Config from mrcnn import utils import mrcnn.model as modellib from mrcnn import visualize from mrcnn.model import log # In[5]: get_ipython().system('wget --quiet https://github.com/matterport/Mask_RCNN/releases/download/v2.0/mask_rcnn_coco.h5') get_ipython().system('ls -lh mask_rcnn_coco.h5') COCO_WEIGHTS_PATH = 'mask_rcnn_coco.h5' # # Set Config # Mask R-CNN has a load of hyperparameters. I only adjust some of them. # In[6]: class FashionConfig(Config): NAME = "fashion" NUM_CLASSES = NUM_CATS + 1 # +1 for the background class GPU_COUNT = 1 IMAGES_PER_GPU = 4 # a memory error occurs when IMAGES_PER_GPU is too high BACKBONE = 'resnet50' IMAGE_MIN_DIM = IMAGE_SIZE IMAGE_MAX_DIM = IMAGE_SIZE IMAGE_RESIZE_MODE = 'none' RPN_ANCHOR_SCALES = (16, 32, 64, 128, 256) #DETECTION_NMS_THRESHOLD = 0.0 # STEPS_PER_EPOCH should be the number of instances # divided by (GPU_COUNT*IMAGES_PER_GPU), and so should VALIDATION_STEPS; # however, due to the time limit, I set them so that this kernel can be run in 9 hours STEPS_PER_EPOCH = 1000 VALIDATION_STEPS = 200 config = FashionConfig() config.display() # # Make Datasets # In[7]: with open(DATA_DIR/"label_descriptions.json") as f: label_descriptions = json.load(f) label_names = [x['name'] for x in label_descriptions['categories']] # In[8]: segment_df = pd.read_csv(DATA_DIR/"train.csv") multilabel_percent = len(segment_df[segment_df['ClassId'].str.contains('_')])/len(segment_df)*100 print(f"Segments that have attributes: {multilabel_percent:.2f}%") # Segments that contain attributes are only 3.46% of data, and [according to the host](https://www.kaggle.com/c/imaterialist-fashion-2019-FGVC6/discussion/90643#523135), 80% of images have no attribute. So, in the first step, we can only deal with categories to reduce the complexity of the task. # In[9]: segment_df['CategoryId'] = segment_df['ClassId'].str.split('_').str[0] print("Total segments: ", len(segment_df)) segment_df.head() # Rows with the same image are grouped together because the subsequent operations perform in an image level. # In[10]: image_df = segment_df.groupby('ImageId')['EncodedPixels', 'CategoryId'].agg(lambda x: list(x)) size_df = segment_df.groupby('ImageId')['Height', 'Width'].mean() image_df = image_df.join(size_df, on='ImageId') print("Total images: ", len(image_df)) image_df.head() # Here is the custom function that resizes an image. # In[11]: def resize_image(image_path): img = cv2.imread(image_path) img = cv2.cvtColor(img, cv2.COLOR_BGR2RGB) img = cv2.resize(img, (IMAGE_SIZE, IMAGE_SIZE), interpolation=cv2.INTER_AREA) return img # The crucial part is to create a dataset for this task. # In[12]: class FashionDataset(utils.Dataset): def __init__(self, df): super().__init__(self) # Add classes for i, name in enumerate(label_names): self.add_class("fashion", i+1, name) # Add images for i, row in df.iterrows(): self.add_image("fashion", image_id=row.name, path=str(DATA_DIR/'train'/row.name), labels=row['CategoryId'], annotations=row['EncodedPixels'], height=row['Height'], width=row['Width']) def image_reference(self, image_id): info = self.image_info[image_id] return info['path'], [label_names[int(x)] for x in info['labels']] def load_image(self, image_id): return resize_image(self.image_info[image_id]['path']) def load_mask(self, image_id): info = self.image_info[image_id] mask = np.zeros((IMAGE_SIZE, IMAGE_SIZE, len(info['annotations'])), dtype=np.uint8) labels = [] for m, (annotation, label) in enumerate(zip(info['annotations'], info['labels'])): sub_mask = np.full(info['height']*info['width'], 0, dtype=np.uint8) annotation = [int(x) for x in annotation.split(' ')] for i, start_pixel in enumerate(annotation[::2]): sub_mask[start_pixel: start_pixel+annotation[2*i+1]] = 1 sub_mask = sub_mask.reshape((info['height'], info['width']), order='F') sub_mask = cv2.resize(sub_mask, (IMAGE_SIZE, IMAGE_SIZE), interpolation=cv2.INTER_NEAREST) mask[:, :, m] = sub_mask labels.append(int(label)+1) return mask, np.array(labels) # Let's visualize some random images and their masks. # In[13]: dataset = FashionDataset(image_df) dataset.prepare() for i in range(6): image_id = random.choice(dataset.image_ids) print(dataset.image_reference(image_id)) image = dataset.load_image(image_id) mask, class_ids = dataset.load_mask(image_id) visualize.display_top_masks(image, mask, class_ids, dataset.class_names, limit=4) # Now, the data are partitioned into train and validation sets. # In[14]: # This code partially supports k-fold training, # you can specify the fold to train and the total number of folds here FOLD = 0 N_FOLDS = 5 kf = KFold(n_splits=N_FOLDS, random_state=42, shuffle=True) splits = kf.split(image_df) # ideally, this should be multilabel stratification def get_fold(): for i, (train_index, valid_index) in enumerate(splits): if i == FOLD: return image_df.iloc[train_index], image_df.iloc[valid_index] train_df, valid_df = get_fold() train_dataset = FashionDataset(train_df) train_dataset.prepare() valid_dataset = FashionDataset(valid_df) valid_dataset.prepare() # Let's visualize class distributions of the train and validation data. # In[15]: train_segments = np.concatenate(train_df['CategoryId'].values).astype(int) print("Total train images: ", len(train_df)) print("Total train segments: ", len(train_segments)) plt.figure(figsize=(12, 3)) values, counts = np.unique(train_segments, return_counts=True) plt.bar(values, counts) plt.xticks(values, label_names, rotation='vertical') plt.show() valid_segments = np.concatenate(valid_df['CategoryId'].values).astype(int) print("Total train images: ", len(valid_df)) print("Total validation segments: ", len(valid_segments)) plt.figure(figsize=(12, 3)) values, counts = np.unique(valid_segments, return_counts=True) plt.bar(values, counts) plt.xticks(values, label_names, rotation='vertical') plt.show() # # Train # In[16]: # Note that any hyperparameters here, such as LR, may still not be optimal LR = 1e-4 EPOCHS = [2, 6, 8] import warnings warnings.filterwarnings("ignore") # This section creates a Mask R-CNN model and specifies augmentations to be used. # In[17]: model = modellib.MaskRCNN(mode='training', config=config, model_dir=ROOT_DIR) model.load_weights(COCO_WEIGHTS_PATH, by_name=True, exclude=[ 'mrcnn_class_logits', 'mrcnn_bbox_fc', 'mrcnn_bbox', 'mrcnn_mask']) # In[18]: augmentation = iaa.Sequential([ iaa.Fliplr(0.5) # only horizontal flip here ]) # First, we train only the heads. # In[19]: get_ipython().run_cell_magic('time', '', "model.train(train_dataset, valid_dataset,\n learning_rate=LR*2, # train heads with higher lr to speedup learning\n epochs=EPOCHS[0],\n layers='heads',\n augmentation=None)\n\nhistory = model.keras_model.history.history") # Then, all layers are trained. # In[20]: get_ipython().run_cell_magic('time', '', "model.train(train_dataset, valid_dataset,\n learning_rate=LR,\n epochs=EPOCHS[1],\n layers='all',\n augmentation=augmentation)\n\nnew_history = model.keras_model.history.history\nfor k in new_history: history[k] = history[k] + new_history[k]") # Afterwards, we reduce LR and train again. # In[21]: get_ipython().run_cell_magic('time', '', "model.train(train_dataset, valid_dataset,\n learning_rate=LR/5,\n epochs=EPOCHS[2],\n layers='all',\n augmentation=augmentation)\n\nnew_history = model.keras_model.history.history\nfor k in new_history: history[k] = history[k] + new_history[k]") # Let's visualize training history and choose the best epoch. # In[22]: epochs = range(EPOCHS[-1]) plt.figure(figsize=(18, 6)) plt.subplot(131) plt.plot(epochs, history['loss'], label="train loss") plt.plot(epochs, history['val_loss'], label="valid loss") plt.legend() plt.subplot(132) plt.plot(epochs, history['mrcnn_class_loss'], label="train class loss") plt.plot(epochs, history['val_mrcnn_class_loss'], label="valid class loss") plt.legend() plt.subplot(133) plt.plot(epochs, history['mrcnn_mask_loss'], label="train mask loss") plt.plot(epochs, history['val_mrcnn_mask_loss'], label="valid mask loss") plt.legend() plt.show() # In[23]: best_epoch = np.argmin(history["val_loss"]) + 1 print("Best epoch: ", best_epoch) print("Valid loss: ", history["val_loss"][best_epoch-1]) # # Predict # The final step is to use our model to predict test data. # In[24]: glob_list = glob.glob(f'/kaggle/working/fashion*/mask_rcnn_fashion_{best_epoch:04d}.h5') model_path = glob_list[0] if glob_list else '' # This cell defines InferenceConfig and loads the best trained model. # In[25]: class InferenceConfig(FashionConfig): GPU_COUNT = 1 IMAGES_PER_GPU = 1 inference_config = InferenceConfig() model = modellib.MaskRCNN(mode='inference', config=inference_config, model_dir=ROOT_DIR) assert model_path != '', "Provide path to trained weights" print("Loading weights from ", model_path) model.load_weights(model_path, by_name=True) # Then, load the submission data. # In[26]: sample_df = pd.read_csv(DATA_DIR/"sample_submission.csv") sample_df.head() # Here is the main prediction steps, along with some helper functions. # In[27]: # Convert data to run-length encoding def to_rle(bits): rle = [] pos = 0 for bit, group in itertools.groupby(bits): group_list = list(group) if bit: rle.extend([pos, sum(group_list)]) pos += len(group_list) return rle # In[28]: # Since the submission system does not permit overlapped masks, we have to fix them def refine_masks(masks, rois): areas = np.sum(masks.reshape(-1, masks.shape[-1]), axis=0) mask_index = np.argsort(areas) union_mask = np.zeros(masks.shape[:-1], dtype=bool) for m in mask_index: masks[:, :, m] = np.logical_and(masks[:, :, m], np.logical_not(union_mask)) union_mask = np.logical_or(masks[:, :, m], union_mask) for m in range(masks.shape[-1]): mask_pos = np.where(masks[:, :, m]==True) if np.any(mask_pos): y1, x1 = np.min(mask_pos, axis=1) y2, x2 = np.max(mask_pos, axis=1) rois[m, :] = [y1, x1, y2, x2] return masks, rois # In[29]: get_ipython().run_cell_magic('time', '', "sub_list = []\nmissing_count = 0\nfor i, row in tqdm(sample_df.iterrows(), total=len(sample_df)):\n image = resize_image(str(DATA_DIR/'test'/row['ImageId']))\n result = model.detect([image])[0]\n if result['masks'].size > 0:\n masks, _ = refine_masks(result['masks'], result['rois'])\n for m in range(masks.shape[-1]):\n mask = masks[:, :, m].ravel(order='F')\n rle = to_rle(mask)\n label = result['class_ids'][m] - 1\n sub_list.append([row['ImageId'], ' '.join(list(map(str, rle))), label])\n else:\n # The system does not allow missing ids, this is an easy way to fill them \n sub_list.append([row['ImageId'], '1 1', 23])\n missing_count += 1") # The submission file is created, when all predictions are ready. # In[30]: submission_df = pd.DataFrame(sub_list, columns=sample_df.columns.values) print("Total image results: ", submission_df['ImageId'].nunique()) print("Missing Images: ", missing_count) submission_df.head() # In[31]: submission_df.to_csv("submission.csv", index=False) # Finally, it's pleasing to visualize the results! Sample images contain both fashion models and predictions from the Mask R-CNN model. # In[32]: for i in range(9): image_id = sample_df.sample()['ImageId'].values[0] image_path = str(DATA_DIR/'test'/image_id) img = cv2.imread(image_path) img = cv2.cvtColor(img, cv2.COLOR_BGR2RGB) result = model.detect([resize_image(image_path)]) r = result[0] if r['masks'].size > 0: masks = np.zeros((img.shape[0], img.shape[1], r['masks'].shape[-1]), dtype=np.uint8) for m in range(r['masks'].shape[-1]): masks[:, :, m] = cv2.resize(r['masks'][:, :, m].astype('uint8'), (img.shape[1], img.shape[0]), interpolation=cv2.INTER_NEAREST) y_scale = img.shape[0]/IMAGE_SIZE x_scale = img.shape[1]/IMAGE_SIZE rois = (r['rois'] * [y_scale, x_scale, y_scale, x_scale]).astype(int) masks, rois = refine_masks(masks, rois) else: masks, rois = r['masks'], r['rois'] visualize.display_instances(img, rois, masks, r['class_ids'], ['bg']+label_names, r['scores'], title=image_id, figsize=(12, 12)) # My code is largely based on [this Mask-RCNN kernel](https://www.kaggle.com/hmendonca/mask-rcnn-and-coco-transfer-learning-lb-0-155) and borrowed some ideas from [the U-Net Baseline kernel](https://www.kaggle.com/go1dfish/u-net-baseline-by-pytorch-in-fgvc6-resize). So, I would like to thank the kernel authors for sharing insights and programming techniques. Importantly, an image segmentation task can be accomplished with short code and good accuracy thanks to [Matterport's implementation](https://github.com/matterport/Mask_RCNN) and a deep learning line of researches culminating in [Mask R-CNN](https://arxiv.org/abs/1703.06870). # # I am sorry that I published this kernel quite late, beyond the halfway of a timeline. I just started working for this competition about a week ago, and to my surprise, the score fell in the range of silver medals at that time. I have no dedicated GPU and no time to further tune the model, so I decided to make this kernel public as a starter guide for anyone who is interested to join this delightful competition. # # <img src='https://i.imgur.com/j6LPLQc.png'> # Hope you guys like this kernel. If there are any bugs, please let me know. # # P.S. When clicking 'Submit to Competition' button, I always run into 404 erros, so I have to save a submission file and upload it to the submission page for submitting. The public LB score of this kernel is around **0.07**.
PavelHudau/Algorithms
src/test/java/com/pavelhudau/burrowswheeler/TestMoveToFront.java
<reponame>PavelHudau/Algorithms<filename>src/test/java/com/pavelhudau/burrowswheeler/TestMoveToFront.java package com.pavelhudau.burrowswheeler; import org.junit.jupiter.params.ParameterizedTest; import org.junit.jupiter.params.provider.ValueSource; import static org.junit.jupiter.api.Assertions.*; public class TestMoveToFront { @ParameterizedTest @ValueSource(strings = { "ABRACADABRA!", "AAA", "A" }) void testEncodeAndDecode(String initialStr) { // GIVEN StdInOutHelper inOutHelperEncode = new StdInOutHelper(initialStr); // WHEN MoveToFront.main(new String[]{"-"}); // Encode byte[] encoded = inOutHelperEncode.readOutputAndClose(); StdInOutHelper inOutHelperDecode = new StdInOutHelper(encoded); MoveToFront.main(new String[]{"+"}); // Decode byte[] decoded = inOutHelperDecode.readOutputAndClose(); String decodedStr = new String(decoded); // THEN assertEquals(initialStr, decodedStr); } }
SINTEF-SIT/project_gravity
controller/src/main/java/sintef/android/controller/sensor/data/MagneticFieldData.java
<reponame>SINTEF-SIT/project_gravity /* 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 sintef.android.controller.sensor.data; public class MagneticFieldData extends SensorDataObject { /** * All values are in micro-Tesla (uT) and measure the ambient magnetic field in the X, Y and Z axis. */ public MagneticFieldData(float[] values) { super(values); } public MagneticFieldData(float x, float y, float z) { super(new float[] {x, y, z}); } public float getX() { return getValues()[0]; } public float getY() { return getValues()[1]; } public float getZ() { return getValues()[2]; } }
kmamal/node-sdl
examples/02-raw-drawing/index.js
<reponame>kmamal/node-sdl<gh_stars>10-100 import sdl from '@kmamal/sdl' const window = sdl.video.createWindow({ resizable: true }) window.on('resize', () => { const { width, height } = window const stride = width * 4 const buffer = Buffer.alloc(stride * height) let offset = 0 for (let i = 0; i < height; i++) { for (let j = 0; j < width; j++) { buffer[offset++] = Math.floor(256 * i / height) // R buffer[offset++] = Math.floor(256 * j / width) // G buffer[offset++] = 0 // B buffer[offset++] = 255 // A } } window.render(width, height, stride, 'rgba32', buffer) })
Steven128/jlulife
src/FetchInterface/ClassInterface.js
import Global from "../Global"; import AppStorage from "../AppStorage"; export default function getInfo(callback) { var termId = Global.settings.class.currentTermId; if (termId == undefined || termId == "") termId = Global.defRes.teachingTerm; let loginURL = "http://10.60.65.8/ntms/service/res.do"; fetch(loginURL, { method: "POST", headers: { Accept: "*/*", "Accept-Encoding": "gzip, deflate", "Accept-Language": "zh-CN,zh;q=0.9", Connection: "keep-alive", "Content-Type": "application/json", Cookie: "loginPage=userLogin.jsp; pwdStrength=1; alu=" + Global.loginInfo.j_username + "; " + Global.cookie, Host: "10.60.65.8", Origin: "http://10.60.65.8", Referer: "http://10.60.65.8/ntms/index.do" }, body: JSON.stringify({ tag: "teachClassStud@schedule", branch: "default", params: { termId: termId, studId: Global.defRes.personId } }) }) .then(response => response.json()) .then(responseJson => { var classJson = parseclassJson(responseJson.value); AppStorage._save("classJson", classJson); callback({ message: "success", content: classJson }); }) .catch(error => { if (__DEV__) { console.log("error"); console.error(error); console.log(responseJson); } callback({ message: "error" }); Global.isOnline = false; Global.cookie = ""; }); } function parseclassJson(classJson) { var parsedData = []; for (var i in classJson) { //课程时间 var lessonSchedules = classJson[i].teachClassMaster.lessonSchedules; for (var j in lessonSchedules) { var classroom = lessonSchedules[j].classroom.fullName; var timeBlock = lessonSchedules[j].timeBlock; var time = "[" + timeBlock.name.match(/第(.*?)节/)[1] + "]"; time = JSON.parse(time); var endWeek = timeBlock.endWeek; var beginWeek = timeBlock.beginWeek; var dayOfWeek = timeBlock.dayOfWeek; var weekOddEven = timeBlock.weekOddEven; if (weekOddEven == undefined) weekOddEven = ""; var singleLesson = {}; singleLesson.classroom = classroom; singleLesson.beginWeek = beginWeek; singleLesson.endWeek = endWeek; singleLesson.dayOfWeek = dayOfWeek; singleLesson.time = time; singleLesson.weekOddEven = weekOddEven; var teachers = []; var lessonTeachers = classJson[i].teachClassMaster.lessonTeachers; for (var j in lessonTeachers) { var teacherName = lessonTeachers[j].teacher.name; teachers.push(teacherName); } //课程名称 var lessonName = classJson[i].teachClassMaster.lessonSegment.fullName; var singleData = {}; singleData.schedule = singleLesson; singleData.teachers = teachers; singleData.lessonName = lessonName; parsedData.push(singleData); } //教师 } var classJson = parsedData; var classList = []; for (var week = 1; week <= Global.weekLength; week++) { classList.push(getClassTable(parsedData, week)); } return classList; } function getClassTable(classJson, week) { var classList = []; for (var i in classJson) { var schedule = classJson[i].schedule; if (schedule.beginWeek <= week && schedule.endWeek >= week) { if ( (schedule.weekOddEven == "O" && week % 2 == 1) || (schedule.weekOddEven == "E" && week % 2 == 0) || schedule.weekOddEven == "" ) classList.push(classJson[i]); } } var classTable = []; for (var weekday = 1; weekday <= 7; weekday++) { var singleDay = []; var hasLessonList = []; for (var i in classList) { if (classList[i].schedule.dayOfWeek == weekday) { classList[i].hasLesson = true; classList[i].color = getColor(); singleDay.push(classList[i]); for (var j in classList[i].schedule.time) { hasLessonList.push(classList[i].schedule.time[j]); } } } for (var count = 1; count <= 11; count++) { var flag = true; for (var inner in hasLessonList) { if (count == hasLessonList[inner]) flag = false; } if (flag) { var blankLesson = {}; blankLesson.hasLesson = false; blankLesson.schedule = {}; blankLesson.schedule.time = []; blankLesson.schedule.time.push(count); singleDay.push(blankLesson); } } var asc = function(x, y) { return x["schedule"]["time"][0] > y["schedule"]["time"][0] ? 1 : -1; }; singleDay = singleDay.sort(asc); classTable.push(singleDay); } return classTable; } function getColor() { var num = Math.floor(Math.random() * 10); return Global.defColor[num]; }
athomas-git/chpl-api
chpl/chpl-service/src/main/java/gov/healthit/chpl/domain/contact/Person.java
package gov.healthit.chpl.domain.contact; import java.io.Serializable; import java.util.HashMap; import javax.xml.bind.annotation.XmlAccessType; import javax.xml.bind.annotation.XmlAccessorType; import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlType; import org.apache.commons.lang3.ObjectUtils; import org.apache.commons.lang3.StringUtils; import com.fasterxml.jackson.annotation.JsonIgnoreProperties; import gov.healthit.chpl.dto.ContactDTO; import lombok.AllArgsConstructor; /** * Domain object representing a Person. It may partially represent a user with access to log into the system * or may represent a point of contact for a developer or product. * */ @XmlType(namespace = "http://chpl.healthit.gov/listings") @XmlAccessorType(XmlAccessType.FIELD) @JsonIgnoreProperties(ignoreUnknown = true) @AllArgsConstructor public class Person implements Serializable { private static final long serialVersionUID = 5376154206189674741L; /** * Person's full name. */ @XmlElement(required = true) private String fullName; /** * Email address of the person. */ @XmlElement(required = true) private String email; /** * Phone number of the person. */ @XmlElement(required = true) private String phoneNumber; /** * Title (Ms., Mr., Dr., etc) of the person. */ @XmlElement(required = false, nillable = true) private String title; public Person() {} public Person(ContactDTO dto) { this.fullName = dto.getFullName(); this.email = dto.getEmail(); this.phoneNumber = dto.getPhoneNumber(); this.title = dto.getTitle(); } public Person(HashMap<String, Object> map) { if (map.containsKey("fullName") && map.get("fullName") != null) { this.fullName = map.get("fullName").toString(); } if (map.containsKey("email") && map.get("email") != null) { this.email = map.get("email").toString(); } if (map.containsKey("phoneNumber") && map.get("phoneNumber") != null) { this.phoneNumber = map.get("phoneNumber").toString(); } if (map.containsKey("title") && map.get("title") != null) { this.title = map.get("title").toString(); } } @Override public boolean equals(Object obj) { if (!(obj instanceof Person)) { return false; } Person anotherPerson = (Person) obj; return ObjectUtils.equals(this.fullName, anotherPerson.fullName) && ObjectUtils.equals(this.email, anotherPerson.email) && ObjectUtils.equals(this.phoneNumber, anotherPerson.phoneNumber) && ObjectUtils.equals(this.title, anotherPerson.title); } @Override public int hashCode() { int hashCode = 0; if (!StringUtils.isEmpty(this.fullName)) { hashCode += this.fullName.hashCode(); } if (!StringUtils.isEmpty(this.email)) { hashCode += this.email.hashCode(); } if (!StringUtils.isEmpty(this.phoneNumber)) { hashCode += this.phoneNumber.hashCode(); } if (!StringUtils.isEmpty(this.title)) { hashCode += this.title.hashCode(); } return hashCode; } public String getFullName() { return fullName; } public void setFullName(String fullName) { this.fullName = fullName; } public String getEmail() { return email; } public void setEmail(String email) { this.email = email; } public String getPhoneNumber() { return phoneNumber; } public void setPhoneNumber(String phoneNumber) { this.phoneNumber = phoneNumber; } public String getTitle() { return title; } public void setTitle(String title) { this.title = title; } @Override public String toString() { return String.format("[Person domain object: [Full Name: %s] [Email: %s]," + "[Phone Number: %s], [Title: %s]]", this.getFullName(), this.getEmail(), this.getPhoneNumber(), this.getTitle()); } }
rajeevvats/klone_webServer
test/misc.c
#include <u/libu.h> #include <klone/utils.h> struct htmlenc_vec_s { const char *src, *exp; int ssz, esz; /* source and exp size */ }; #define HTMLENC_VEC( src, exp ) { src, exp, (sizeof(src)-1), (sizeof(exp)-1) } const struct htmlenc_vec_s htmlenc_vec[] = { HTMLENC_VEC( "", ""), HTMLENC_VEC( "a", "a"), HTMLENC_VEC( "ab", "ab"), HTMLENC_VEC( "abc", "abc"), HTMLENC_VEC( "abcd", "abcd"), HTMLENC_VEC( "ab&cd", "ab&amp;cd"), HTMLENC_VEC( "ab<cd", "ab&lt;cd"), HTMLENC_VEC( "&", "&amp;"), HTMLENC_VEC( "<", "&lt;"), HTMLENC_VEC( ">", "&gt;"), HTMLENC_VEC( "\"", "&quot;"), HTMLENC_VEC( "\'", "&#39;"), HTMLENC_VEC( "&<>\"\'", "&amp;&lt;&gt;&quot;&#39;"), HTMLENC_VEC( "A&<>\"\'Z", "A&amp;&lt;&gt;&quot;&#39;Z"), HTMLENC_VEC( "A&B<C>D\"E\'Z", "A&amp;B&lt;C&gt;D&quot;E&#39;Z"), HTMLENC_VEC( "\x01", "\x01"), /* not printable chars are not encoded */ // FIXME: there are other HTML entities? { NULL, NULL, 0, 0 } }; int test_hexencoding(void) { /* +1 is to also encode '\0' */ unsigned char src[255 + 1], buf0[1024], buf1[1024]; ssize_t wr; int i; memset(src, '*', sizeof(src)); memset(buf0, '*', sizeof(buf0)); memset(buf1, '*', sizeof(buf1)); for(i = 0; i < 256; ++i) src[i] = 255 - i; con_err_if((wr = u_hexncpy(buf0, src, sizeof(src), HEXCPY_ENCODE)) < 0); con_err_if((wr = u_hexncpy(buf1, buf0, wr, HEXCPY_DECODE)) < 0); con_err_if(memcmp(src, buf1, sizeof(src))); return 0; err: return ~0; } int test_sqlencoding(void) { /* +1 is to also encode '\0' */ unsigned char src[255 + 1], buf0[1024], buf1[1024]; ssize_t wr; int i; memset(src, '*', sizeof(src)); memset(buf0, '*', sizeof(buf0)); memset(buf1, '*', sizeof(buf1)); for(i = 0; i < 256; ++i) src[i] = 255 - i; con_err_if((wr = u_sqlncpy(buf0, src, sizeof(src), SQLCPY_ENCODE)) < 0); con_err_if((wr = u_sqlncpy(buf1, buf0, wr, SQLCPY_DECODE)) < 0); con_err_if(memcmp(src, buf1, sizeof(src))); return 0; err: return ~0; } int test_htmlencoding_1(void) { enum { BUFSZ = 1024 }; const char *src, *exp; char buf0[BUFSZ], buf1[BUFSZ]; ssize_t wr; int i, ssz, esz; for(i = 0; htmlenc_vec[i].src != NULL; ++i) { src = htmlenc_vec[i].src; exp = htmlenc_vec[i].exp; /* expected result */ ssz = htmlenc_vec[i].ssz; esz = htmlenc_vec[i].esz; con_err_if((wr = u_htmlncpy(buf0, src, ssz, HTMLCPY_ENCODE)) < 0); con_err_if(memcmp(buf0, exp, esz)); con_err_if((wr = u_htmlncpy(buf1, buf0, wr, HTMLCPY_DECODE)) < 0); con_err_ifm(wr != ssz, "%ld %d", wr, ssz); con_err_if(memcmp(src, buf1, ssz)); } return 0; err: return ~0; } int test_htmlencoding_0(void) { /* +1 is to also encode '\0' */ unsigned char src[255 + 1], buf0[1024], buf1[1024]; ssize_t wr; int i; memset(src, '*', sizeof(src)); memset(buf0, '*', sizeof(buf0)); memset(buf1, '*', sizeof(buf1)); for(i = 0; i < 256; ++i) src[i] = 255 - i; con_err_if((wr = u_htmlncpy(buf0, src, sizeof(src), HTMLCPY_ENCODE)) < 0); con_err_if((wr = u_htmlncpy(buf1, buf0, wr, HTMLCPY_DECODE)) < 0); for(i = 0; i < 256; ++i) if(src[i] != buf1[i]) u_con("%d: %x %x", i, src[i], buf1[i]); con_err_if(memcmp(src, buf1, sizeof(src))); return 0; err: return ~0; } int test_urlencoding(void) { /* +1 is to also encode '\0' */ unsigned char src[255 + 1], buf0[1024], buf1[1024]; ssize_t wr; int i; memset(src, '*', sizeof(src)); memset(buf0, '*', sizeof(buf0)); memset(buf1, '*', sizeof(buf1)); for(i = 0; i < 256; ++i) src[i] = 255 - i; con_err_if((wr = u_urlncpy(buf0, src, sizeof(src), URLCPY_ENCODE)) < 0); con_err_if((wr = u_urlncpy(buf1, buf0, wr, URLCPY_DECODE)) < 0); con_err_if(memcmp(src, buf1, sizeof(src))); return 0; err: return ~0; } U_TEST_MODULE( misc ) { U_TEST_RUN( test_htmlencoding_0 ); U_TEST_RUN( test_htmlencoding_1 ); U_TEST_RUN( test_urlencoding ); U_TEST_RUN( test_hexencoding ); U_TEST_RUN( test_sqlencoding ); return 0; }
mcarcaso/foam2
src/foam/cross_platform/ui/widget/array/FObjectArrayViewItemWrapperDetailView.js
foam.CLASS({ package: 'foam.cross_platform.ui.widget.array', name: 'FObjectArrayViewItemWrapperDetailView', requires: [ 'foam.cross_platform.ui.widget.DynamicDetailView' ], implements: [ 'foam.cross_platform.ui.widget.DetailView', ], swiftImports: [ 'UIKit', ], properties: [ { class: 'FObjectProperty', of: 'foam.cross_platform.ui.widget.array.FObjectArrayViewItemWrapper', name: 'data' }, { class: 'FObjectProperty', of: 'foam.cross_platform.ui.widget.DynamicDetailView', name: 'dv', androidFactory: ` foam.cross_platform.ui.widget.DynamicDetailView dv = DynamicDetailView_create() .setData$(getData$().dot("value")) .build(); onDetach(dv); return dv; `, swiftFactory: ` let dv = DynamicDetailView_create() .setData$(getData$().dot("value")) .build(); onDetach(dv); return dv; `, }, { androidType: 'android.view.View', swiftType: 'UIView?', name: 'view', androidFactory: ` return getDv().getView(); `, swiftFactory: ` return getDv()?.getView(); `, }, ], methods: [ { name: 'getOf', androidCode: ` return foam.cross_platform.ui.widget.array.FObjectArrayViewItemWrapper.CLS_(); `, swiftCode: ` return foam_cross_platform_ui_widget_array_FObjectArrayViewItemWrapper.CLS_(); `, }, ] });
alemoles/tutorials
graphql/graphql-error-handling/src/main/java/com/baeldung/graphql/error/handling/exception/VehicleAlreadyPresentException.java
<filename>graphql/graphql-error-handling/src/main/java/com/baeldung/graphql/error/handling/exception/VehicleAlreadyPresentException.java package com.baeldung.graphql.error.handling.exception; import java.util.Map; public class VehicleAlreadyPresentException extends AbstractGraphQLException { public VehicleAlreadyPresentException(String message) { super(message); } public VehicleAlreadyPresentException(String message, Map<String, Object> additionParams) { super(message, additionParams); } }
Imobiliario-MrBelly/LP2
mysql-connector-java-8.0.23/src/test/java/com/mysql/cj/MessagesTest.java
/* * Copyright (c) 2015, 2020, Oracle and/or its affiliates. * * This program is free software; you can redistribute it and/or modify it under * the terms of the GNU General Public License, version 2.0, as published by the * Free Software Foundation. * * This program is also distributed with certain software (including but not * limited to OpenSSL) that is licensed under separate terms, as designated in a * particular file or component or in included license documentation. The * authors of MySQL hereby grant you an additional permission to link the * program and your derivative works with the separately licensed software that * they have included with MySQL. * * Without limiting anything contained in the foregoing, this file, which is * part of MySQL Connector/J, is also subject to the Universal FOSS Exception, * version 1.0, a copy of which can be found at * http://oss.oracle.com/licenses/universal-foss-exception. * * This program is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS * FOR A PARTICULAR PURPOSE. See the GNU General Public License, version 2.0, * for more details. * * You should have received a copy of the GNU General Public License along with * this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ package com.mysql.cj; import static org.junit.jupiter.api.Assertions.assertEquals; import org.junit.jupiter.api.Test; public class MessagesTest { @Test public void testLocalizedErrorMessages() throws Exception { Exception ex = new Exception(); assertEquals("The database URL cannot be null.", Messages.getString("ConnectionString.0")); assertEquals("Malformed database URL, failed to parse the main URL sections.", Messages.getString("ConnectionString.1")); assertEquals("Malformed database URL, failed to parse the URL authority segment 'Test'.", Messages.getString("ConnectionString.2", new Object[] { "Test" })); assertEquals("Failed to parse the host:port pair 'host:123'.", Messages.getString("ConnectionString.3", new Object[] { "host:123" })); assertEquals("Malformed database URL, failed to parse the connection string near 'Test'.", Messages.getString("ConnectionString.4", new Object[] { "Test" })); assertEquals("Connector/J cannot handle a database URL of type 'Test'.", Messages.getString("ConnectionString.5", new Object[] { "Test" })); assertEquals("Connector/J cannot handle a database URL of type 'Test' that takes 100 hosts.", Messages.getString("ConnectionString.6", new Object[] { "Test", 100 })); assertEquals("Malformed database URL, failed to parse the port '123' as a number.", Messages.getString("ConnectionString.7", new Object[] { 123 })); assertEquals("Illegal transformation to the 'Test' property. The value 'Ten' is not a valid number.", Messages.getString("ConnectionString.8", new Object[] { "Test", "Ten" })); assertEquals("Unable to create properties transform instance 'Test' due to underlying exception: " + ex.toString(), Messages.getString("ConnectionString.9", new Object[] { "Test", ex.toString() })); assertEquals("Can't find configuration template named 'Test'", Messages.getString("ConnectionString.10", new Object[] { "Test" })); assertEquals("Unable to load configuration template 'Test' due to underlying IOException", Messages.getString("ConnectionString.11", new Object[] { "Test" })); assertEquals("Illegal database URL, host 'Test1' is duplicated but 'Test2' connections can only handle one instance of each host:port pair.", Messages.getString("ConnectionString.12", new Object[] { "Test1", "Test2" })); assertEquals( "Illegal database URL, Host 'Test1' is duplicated in the combined hosts list (sources & replicas) but 'Test2' connections can only handle one instance of each host:port pair.", Messages.getString("ConnectionString.13", new Object[] { "Test1", "Test2" })); assertEquals("Illegal database URL, in a 'Test' multi-host connection it is required the same credentials in all hosts.", Messages.getString("ConnectionString.14", new Object[] { "Test" })); assertEquals("Illegal database URL, in a 'Test' multi-host connection it is required that all or none of the hosts set a \"priority\" value.", Messages.getString("ConnectionString.15", new Object[] { "Test" })); assertEquals("Illegal database URL, in a 'Test' multi-host connection the \"priority\" setting must be a value between 0 and 100.", Messages.getString("ConnectionString.16", new Object[] { "Test" })); assertEquals("Cannot load connection class because of underlying exception: " + ex.toString(), Messages.getString("NonRegisteringDriver.17", new Object[] { ex.toString() })); assertEquals("Unsupported character encoding 'Test'", Messages.getString("Field.12", new Object[] { "Test" })); assertEquals("Unsupported character encoding 'Test'", Messages.getString("StringUtils.0", new Object[] { "Test" })); assertEquals("indexToWriteAt must be >= 1", Messages.getString("Blob.0")); assertEquals("IO Error while writing bytes to blob", Messages.getString("Blob.1")); assertEquals("\"pos\" argument can not be < 1.", Messages.getString("Blob.2")); assertEquals("\"pos\" argument can not be larger than the BLOB's length.", Messages.getString("Blob.3")); assertEquals("\"pos\" + \"length\" arguments can not be larger than the BLOB's length.", Messages.getString("Blob.4")); assertEquals("\"len\" argument can not be < 1.", Messages.getString("Blob.5")); assertEquals("\"len\" argument can not be larger than the BLOB's length.", Messages.getString("Blob.6")); assertEquals("Invalid operation on closed BLOB", Messages.getString("Blob.7")); assertEquals("Requested stream length of Test2 is out of range, given blob length of Test0 and starting position of Test1.", Messages.getString("Blob.invalidStreamLength", new Object[] { "Test0", "Test1", "Test2" })); assertEquals("Position 'pos' can not be < 1 or > blob length.", Messages.getString("Blob.invalidStreamPos")); assertEquals("Emulated BLOB locators must come from a ResultSet with only one table selected, and all primary keys selected", Messages.getString("Blob.8")); assertEquals("BLOB data not found! Did primary keys change?", Messages.getString("Blob.9")); assertEquals("Unknown type '0' in column '1' of '2' in binary-encoded result set.", Messages.getString("MysqlIO.97", new Object[] { 0, 1, 2 })); assertEquals("No parameter named 'Test'", Messages.getString("CallableStatement.3", new Object[] { "Test" })); assertEquals("Parameter named 'Test' is not an OUT parameter", Messages.getString("CallableStatement.5", new Object[] { "Test" })); assertEquals("Can't find local placeholder mapping for parameter named 'Test'.", Messages.getString("CallableStatement.6", new Object[] { "Test" })); assertEquals("Parameter number 0 is not an OUT parameter", Messages.getString("CallableStatement.9", new Object[] { 0 })); assertEquals("Parameter index of 10 is out of range (1, 5)", Messages.getString("CallableStatement.11", new Object[] { 10, 5 })); assertEquals("Parameter 0 is not registered as an output parameter", Messages.getString("CallableStatement.21", new Object[] { 0 })); assertEquals("Can't set out parameters", Messages.getString("CallableStatement.24")); assertEquals("Can't call executeBatch() on CallableStatement with OUTPUT parameters", Messages.getString("CallableStatement.25")); assertEquals("Illegal starting position for search, '10'", Messages.getString("Clob.8", new Object[] { 10 })); assertEquals("Java does not support the MySQL character encoding 'Test'.", Messages.getString("Connection.5", new Object[] { "Test" })); assertEquals( "Unknown initial character set index 'Test' received from server. Initial client character set can be forced via the 'characterEncoding' property.", Messages.getString("Connection.6", new Object[] { "Test" })); assertEquals("Can't map Test given for characterSetResults to a supported MySQL encoding.", Messages.getString("Connection.7", new Object[] { "Test" })); assertEquals( "Connection setting too low for 'maxAllowedPacket'. When 'useServerPrepStmts=true', 'maxAllowedPacket' must be higher than 10. Check also 'max_allowed_packet' in MySQL configuration files.", Messages.getString("Connection.15", new Object[] { 10 })); assertEquals("Savepoint 'Test' does not exist", Messages.getString("Connection.22", new Object[] { "Test" })); assertEquals("Unsupported transaction isolation level 'Test'", Messages.getString("Connection.25", new Object[] { "Test" })); assertEquals( "User does not have access to metadata required to determine stored procedure parameter types." + " If rights can not be granted, configure connection with \"noAccessToProcedureBodies=true\" " + "to have driver generate parameters that represent INOUT strings irregardless of actual parameter types.", Messages.getString("DatabaseMetaData.4")); assertEquals("Syntax error while processing {fn convert (... , ...)} token, missing opening parenthesis in token 'Test'.", Messages.getString("EscapeProcessor.4", new Object[] { "Test" })); assertEquals("Unsupported conversion type 'Test' found while processing escape token.", Messages.getString("EscapeProcessor.7", new Object[] { "Test" })); assertEquals("Can't perform requested operation after getResult() has been called to write XML data", Messages.getString("MysqlSQLXML.1")); assertEquals("Can't set IN parameter for return value of stored function call.", Messages.getString("PreparedStatement.63")); assertEquals("'Test' is not a valid numeric or approximate numeric value", Messages.getString("PreparedStatement.64", new Object[] { "Test" })); assertEquals("Can't set scale of 'Test1' for DECIMAL argument 'Test2'", Messages.getString("PreparedStatement.65", new Object[] { "Test1", "Test2" })); assertEquals("No conversion from Test to Types.BOOLEAN possible.", Messages.getString("PreparedStatement.66", new Object[] { "Test" })); assertEquals("Packet for query is too large (100 > 10). You can change this value on the server by setting the 'max_allowed_packet' variable.", Messages.getString("PacketTooBigException.0", new Object[] { 100, 10 })); assertEquals("Can't use configured regex due to underlying exception.", Messages.getString("ResultSetScannerInterceptor.1")); assertEquals("Can't set autocommit to 'true' on an XAConnection", Messages.getString("ConnectionWrapper.0")); assertEquals("Can't call commit() on an XAConnection associated with a global transaction", Messages.getString("ConnectionWrapper.1")); assertEquals("Can't call rollback() on an XAConnection associated with a global transaction", Messages.getString("ConnectionWrapper.2")); assertEquals("Illegal hour value '99' for java.sql.Time type in value 'Test'.", Messages.getString("TimeUtil.0", new Object[] { 99, "Test" })); assertEquals("Illegal minute value '99' for java.sql.Time type in value 'Test'.", Messages.getString("TimeUtil.1", new Object[] { 99, "Test" })); assertEquals("Illegal second value '99' for java.sql.Time type in value 'Test'.", Messages.getString("TimeUtil.2", new Object[] { 99, "Test" })); assertEquals("Can not call setNCharacterStream() when connection character set isn't UTF-8", Messages.getString("ServerPreparedStatement.28")); assertEquals("Can not call setNClob() when connection character set isn't UTF-8", Messages.getString("ServerPreparedStatement.29")); assertEquals("Can not call setNString() when connection character set isn't UTF-8", Messages.getString("ServerPreparedStatement.30")); assertEquals("Can not call getNCharacterStream() when field's charset isn't UTF-8", Messages.getString("ResultSet.11")); assertEquals("Can not call getNClob() when field's charset isn't UTF-8", Messages.getString("ResultSet.12")); assertEquals("Can not call getNString() when field's charset isn't UTF-8", Messages.getString("ResultSet.14")); assertEquals("Internal error - conversion method doesn't support this type", Messages.getString("ResultSet.15")); assertEquals("Can not call updateNCharacterStream() when field's character set isn't UTF-8", Messages.getString("ResultSet.16")); assertEquals("Can not call updateNClob() when field's character set isn't UTF-8", Messages.getString("ResultSet.17")); assertEquals("Can not call updateNString() when field's character set isn't UTF-8", Messages.getString("ResultSet.18")); // TODO: Extend for all escaped messages. } }
rimmartin/cctbx_project
scitbx/stl/vector.py
<reponame>rimmartin/cctbx_project<filename>scitbx/stl/vector.py<gh_stars>0 from __future__ import division import scitbx.stl.set # import dependency import boost.python ext = boost.python.import_ext("scitbx_stl_vector_ext") from scitbx_stl_vector_ext import *
kagic/KE2
src/main/java/mod/ke2/handles/HandleBubbleEnchant.java
package mod.ke2.handles; import java.util.List; import java.util.Map; import mod.ke2.entity.machine.EntityBubble; import mod.ke2.init.Ke2Enchants; import net.minecraft.enchantment.Enchantment; import net.minecraft.enchantment.EnchantmentHelper; import net.minecraft.entity.item.EntityItem; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; import net.minecraft.util.EnumHand; import net.minecraft.util.math.AxisAlignedBB; import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; import net.minecraftforge.event.entity.player.PlayerInteractEvent; import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; public class HandleBubbleEnchant { @SubscribeEvent public void onEntityInteract(PlayerInteractEvent.RightClickBlock e) { if (!e.getWorld().isRemote) { if (!e.getItemStack().isEmpty()) { EntityPlayer player = e.getEntityPlayer(); EnumHand hand = player.getActiveHand(); ItemStack itemstack = player.getHeldItem(hand); if (itemstack.isItemEnchanted()) { Map<Enchantment, Integer> enchants = EnchantmentHelper.getEnchantments(itemstack); if (enchants.containsKey(Ke2Enchants.BUBBLE)) { BlockPos pos = e.getPos(); World world = e.getWorld(); List<EntityItem> items = world.<EntityItem>getEntitiesWithinAABB(EntityItem.class, new AxisAlignedBB(pos).grow(1, 1, 1)); for (EntityItem item : items) { if (!item.isDead) { for (@SuppressWarnings("unused") EntityItem Item : items) { EntityBubble bubble = new EntityBubble(world); bubble.setColor(0); bubble.setItem(item.getItem()); bubble.setPosition(item.posX, item.posY, item.posZ); bubble.setHealth(0.5F); bubble.motionY = world.rand.nextDouble() / 2; bubble.playBubbleSound(); item.setDead(); world.spawnEntity(bubble); } } } } } } } } }
Andreas237/AndroidPolicyAutomation
ExtractedJars/Apk_Extractor_com.ext.ui.apk/javafiles/android/support/v4/media/session/MediaSessionCompat$MediaSessionImplBase$MessageHandler.java
// Decompiled by Jad v1.5.8g. Copyright 2001 <NAME>. // Jad home page: http://www.kpdus.com/jad.html // Decompiler options: packimports(3) annotate safe package android.support.v4.media.session; import android.content.Intent; import android.net.Uri; import android.os.*; import android.support.v4.media.MediaDescriptionCompat; import android.support.v4.media.RatingCompat; import android.util.Log; import android.view.KeyEvent; import java.util.List; // Referenced classes of package android.support.v4.media.session: // MediaSessionCompat, PlaybackStateCompat class MediaSessionCompat$MediaSessionImplBase$MessageHandler extends Handler { private void onMediaButtonEvent(KeyEvent keyevent, MediaSessionCompat.Callback callback) { if(keyevent != null && keyevent.getAction() == 0) goto _L2; else goto _L1 // 0 0:aload_1 // 1 1:ifnull 11 // 2 4:aload_1 // 3 5:invokevirtual #95 <Method int KeyEvent.getAction()> // 4 8:ifeq 12 _L1: return; // 5 11:return _L2: long l; if(mState == null) //* 6 12:aload_0 //* 7 13:getfield #83 <Field MediaSessionCompat$MediaSessionImplBase this$0> //* 8 16:getfield #99 <Field PlaybackStateCompat MediaSessionCompat$MediaSessionImplBase.mState> //* 9 19:ifnonnull 122 l = 0L; // 10 22:lconst_0 // 11 23:lstore_3 else //* 12 24:aload_1 //* 13 25:invokevirtual #102 <Method int KeyEvent.getKeyCode()> //* 14 28:lookupswitch 9: default 112 // 79: 113 // 85: 113 // 86: 196 // 87: 166 // 88: 181 // 89: 224 // 90: 209 // 126: 136 // 127: 151 //* 15 112:return //* 16 113:ldc1 #104 <String "MediaSessionCompat"> //* 17 115:ldc1 #106 <String "KEYCODE_MEDIA_PLAY_PAUSE and KEYCODE_HEADSETHOOK are handled already"> //* 18 117:invokestatic #112 <Method int Log.w(String, String)> //* 19 120:pop //* 20 121:return l = mState.getActions(); // 21 122:aload_0 // 22 123:getfield #83 <Field MediaSessionCompat$MediaSessionImplBase this$0> // 23 126:getfield #99 <Field PlaybackStateCompat MediaSessionCompat$MediaSessionImplBase.mState> // 24 129:invokevirtual #118 <Method long PlaybackStateCompat.getActions()> // 25 132:lstore_3 keyevent.getKeyCode(); JVM INSTR lookupswitch 9: default 112 // 79: 113 // 85: 113 // 86: 196 // 87: 166 // 88: 181 // 89: 224 // 90: 209 // 126: 136 // 127: 151; goto _L3 _L4 _L4 _L5 _L6 _L7 _L8 _L9 _L10 _L11 _L8: continue; /* Loop/switch isn't completed */ _L3: return; _L4: Log.w("MediaSessionCompat", "KEYCODE_MEDIA_PLAY_PAUSE and KEYCODE_HEADSETHOOK are handled already"); return; //* 26 133:goto 24 _L10: if((l & 4L) == 0L) goto _L1; else goto _L12 // 27 136:lload_3 // 28 137:ldc2w #119 <Long 4L> // 29 140:land // 30 141:lconst_0 // 31 142:lcmp // 32 143:ifeq 11 _L12: callback.onPlay(); // 33 146:aload_2 // 34 147:invokevirtual #126 <Method void MediaSessionCompat$Callback.onPlay()> return; // 35 150:return _L11: if((l & 2L) == 0L) goto _L1; else goto _L13 // 36 151:lload_3 // 37 152:ldc2w #127 <Long 2L> // 38 155:land // 39 156:lconst_0 // 40 157:lcmp // 41 158:ifeq 11 _L13: callback.onPause(); // 42 161:aload_2 // 43 162:invokevirtual #131 <Method void MediaSessionCompat$Callback.onPause()> return; // 44 165:return _L6: if((l & 32L) == 0L) goto _L1; else goto _L14 // 45 166:lload_3 // 46 167:ldc2w #132 <Long 32L> // 47 170:land // 48 171:lconst_0 // 49 172:lcmp // 50 173:ifeq 11 _L14: callback.onSkipToNext(); // 51 176:aload_2 // 52 177:invokevirtual #136 <Method void MediaSessionCompat$Callback.onSkipToNext()> return; // 53 180:return _L7: if((l & 16L) == 0L) goto _L1; else goto _L15 // 54 181:lload_3 // 55 182:ldc2w #137 <Long 16L> // 56 185:land // 57 186:lconst_0 // 58 187:lcmp // 59 188:ifeq 11 _L15: callback.onSkipToPrevious(); // 60 191:aload_2 // 61 192:invokevirtual #141 <Method void MediaSessionCompat$Callback.onSkipToPrevious()> return; // 62 195:return _L5: if((l & 1L) == 0L) goto _L1; else goto _L16 // 63 196:lload_3 // 64 197:lconst_1 // 65 198:land // 66 199:lconst_0 // 67 200:lcmp // 68 201:ifeq 11 _L16: callback.onStop(); // 69 204:aload_2 // 70 205:invokevirtual #144 <Method void MediaSessionCompat$Callback.onStop()> return; // 71 208:return _L9: if((l & 64L) == 0L) goto _L1; else goto _L17 // 72 209:lload_3 // 73 210:ldc2w #145 <Long 64L> // 74 213:land // 75 214:lconst_0 // 76 215:lcmp // 77 216:ifeq 11 _L17: callback.onFastForward(); // 78 219:aload_2 // 79 220:invokevirtual #149 <Method void MediaSessionCompat$Callback.onFastForward()> return; // 80 223:return if((l & 8L) == 0L) goto _L1; else goto _L18 // 81 224:lload_3 // 82 225:ldc2w #150 <Long 8L> // 83 228:land // 84 229:lconst_0 // 85 230:lcmp // 86 231:ifeq 11 _L18: callback.onRewind(); // 87 234:aload_2 // 88 235:invokevirtual #154 <Method void MediaSessionCompat$Callback.onRewind()> return; // 89 238:return } public void handleMessage(Message message) { MediaSessionCompat.Callback callback = mCallback; // 0 0:aload_0 // 1 1:getfield #83 <Field MediaSessionCompat$MediaSessionImplBase this$0> // 2 4:getfield #160 <Field MediaSessionCompat$Callback MediaSessionCompat$MediaSessionImplBase.mCallback> // 3 7:astore_2 if(callback != null) goto _L2; else goto _L1 // 4 8:aload_2 // 5 9:ifnonnull 13 _L1: return; // 6 12:return _L2: switch(message.what) //* 7 13:aload_1 //* 8 14:getfield #165 <Field int Message.what> { //* 9 17:tableswitch 1 31: default 156 // 1 157 // 2 547 // 3 223 // 4 228 // 5 244 // 6 260 // 7 276 // 8 281 // 9 297 // 10 313 // 11 329 // 12 344 // 13 349 // 14 354 // 15 359 // 16 364 // 17 369 // 18 374 // 19 389 // 20 417 // 21 182 // 22 560 // 23 588 // 24 597 // 25 433 // 26 445 // 27 461 // 28 473 // 29 573 // 30 612 // 31 401 default: return; // 10 156:return case 2: // '\002' break; /* Loop/switch isn't completed */ case 22: // '\026' break MISSING_BLOCK_LABEL_560; case 23: // '\027' break MISSING_BLOCK_LABEL_588; case 24: // '\030' break MISSING_BLOCK_LABEL_597; case 29: // '\035' break MISSING_BLOCK_LABEL_573; case 30: // '\036' break MISSING_BLOCK_LABEL_612; case 1: // '\001' message = ((Message) ((MediaSessionCompat.MediaSessionImplBase.Command)message.obj)); // 11 157:aload_1 // 12 158:getfield #169 <Field Object Message.obj> // 13 161:checkcast #171 <Class MediaSessionCompat$MediaSessionImplBase$Command> // 14 164:astore_1 callback.onCommand(((MediaSessionCompat.MediaSessionImplBase.Command) (message)).command, ((MediaSessionCompat.MediaSessionImplBase.Command) (message)).extras, ((MediaSessionCompat.MediaSessionImplBase.Command) (message)).stub); // 15 165:aload_2 // 16 166:aload_1 // 17 167:getfield #175 <Field String MediaSessionCompat$MediaSessionImplBase$Command.command> // 18 170:aload_1 // 19 171:getfield #179 <Field Bundle MediaSessionCompat$MediaSessionImplBase$Command.extras> // 20 174:aload_1 // 21 175:getfield #183 <Field android.os.ResultReceiver MediaSessionCompat$MediaSessionImplBase$Command.stub> // 22 178:invokevirtual #187 <Method void MediaSessionCompat$Callback.onCommand(String, Bundle, android.os.ResultReceiver)> return; // 23 181:return case 21: // '\025' message = ((Message) ((KeyEvent)message.obj)); // 24 182:aload_1 // 25 183:getfield #169 <Field Object Message.obj> // 26 186:checkcast #91 <Class KeyEvent> // 27 189:astore_1 Intent intent = new Intent("android.intent.action.MEDIA_BUTTON"); // 28 190:new #189 <Class Intent> // 29 193:dup // 30 194:ldc1 #191 <String "android.intent.action.MEDIA_BUTTON"> // 31 196:invokespecial #194 <Method void Intent(String)> // 32 199:astore_3 intent.putExtra("android.intent.extra.KEY_EVENT", ((android.os.Parcelable) (message))); // 33 200:aload_3 // 34 201:ldc1 #196 <String "android.intent.extra.KEY_EVENT"> // 35 203:aload_1 // 36 204:invokevirtual #200 <Method Intent Intent.putExtra(String, android.os.Parcelable)> // 37 207:pop if(!callback.onMediaButtonEvent(intent)) //* 38 208:aload_2 //* 39 209:aload_3 //* 40 210:invokevirtual #203 <Method boolean MediaSessionCompat$Callback.onMediaButtonEvent(Intent)> //* 41 213:ifne 12 { onMediaButtonEvent(((KeyEvent) (message)), callback); // 42 216:aload_0 // 43 217:aload_1 // 44 218:aload_2 // 45 219:invokespecial #205 <Method void onMediaButtonEvent(KeyEvent, MediaSessionCompat$Callback)> return; // 46 222:return } break; case 3: // '\003' callback.onPrepare(); // 47 223:aload_2 // 48 224:invokevirtual #208 <Method void MediaSessionCompat$Callback.onPrepare()> return; // 49 227:return case 4: // '\004' callback.onPrepareFromMediaId((String)message.obj, message.getData()); // 50 228:aload_2 // 51 229:aload_1 // 52 230:getfield #169 <Field Object Message.obj> // 53 233:checkcast #210 <Class String> // 54 236:aload_1 // 55 237:invokevirtual #214 <Method Bundle Message.getData()> // 56 240:invokevirtual #218 <Method void MediaSessionCompat$Callback.onPrepareFromMediaId(String, Bundle)> return; // 57 243:return case 5: // '\005' callback.onPrepareFromSearch((String)message.obj, message.getData()); // 58 244:aload_2 // 59 245:aload_1 // 60 246:getfield #169 <Field Object Message.obj> // 61 249:checkcast #210 <Class String> // 62 252:aload_1 // 63 253:invokevirtual #214 <Method Bundle Message.getData()> // 64 256:invokevirtual #221 <Method void MediaSessionCompat$Callback.onPrepareFromSearch(String, Bundle)> return; // 65 259:return case 6: // '\006' callback.onPrepareFromUri((Uri)message.obj, message.getData()); // 66 260:aload_2 // 67 261:aload_1 // 68 262:getfield #169 <Field Object Message.obj> // 69 265:checkcast #223 <Class Uri> // 70 268:aload_1 // 71 269:invokevirtual #214 <Method Bundle Message.getData()> // 72 272:invokevirtual #227 <Method void MediaSessionCompat$Callback.onPrepareFromUri(Uri, Bundle)> return; // 73 275:return case 7: // '\007' callback.onPlay(); // 74 276:aload_2 // 75 277:invokevirtual #126 <Method void MediaSessionCompat$Callback.onPlay()> return; // 76 280:return case 8: // '\b' callback.onPlayFromMediaId((String)message.obj, message.getData()); // 77 281:aload_2 // 78 282:aload_1 // 79 283:getfield #169 <Field Object Message.obj> // 80 286:checkcast #210 <Class String> // 81 289:aload_1 // 82 290:invokevirtual #214 <Method Bundle Message.getData()> // 83 293:invokevirtual #230 <Method void MediaSessionCompat$Callback.onPlayFromMediaId(String, Bundle)> return; // 84 296:return case 9: // '\t' callback.onPlayFromSearch((String)message.obj, message.getData()); // 85 297:aload_2 // 86 298:aload_1 // 87 299:getfield #169 <Field Object Message.obj> // 88 302:checkcast #210 <Class String> // 89 305:aload_1 // 90 306:invokevirtual #214 <Method Bundle Message.getData()> // 91 309:invokevirtual #233 <Method void MediaSessionCompat$Callback.onPlayFromSearch(String, Bundle)> return; // 92 312:return case 10: // '\n' callback.onPlayFromUri((Uri)message.obj, message.getData()); // 93 313:aload_2 // 94 314:aload_1 // 95 315:getfield #169 <Field Object Message.obj> // 96 318:checkcast #223 <Class Uri> // 97 321:aload_1 // 98 322:invokevirtual #214 <Method Bundle Message.getData()> // 99 325:invokevirtual #236 <Method void MediaSessionCompat$Callback.onPlayFromUri(Uri, Bundle)> return; // 100 328:return case 11: // '\013' callback.onSkipToQueueItem(((Long)message.obj).longValue()); // 101 329:aload_2 // 102 330:aload_1 // 103 331:getfield #169 <Field Object Message.obj> // 104 334:checkcast #238 <Class Long> // 105 337:invokevirtual #241 <Method long Long.longValue()> // 106 340:invokevirtual #245 <Method void MediaSessionCompat$Callback.onSkipToQueueItem(long)> return; // 107 343:return case 12: // '\f' callback.onPause(); // 108 344:aload_2 // 109 345:invokevirtual #131 <Method void MediaSessionCompat$Callback.onPause()> return; // 110 348:return case 13: // '\r' callback.onStop(); // 111 349:aload_2 // 112 350:invokevirtual #144 <Method void MediaSessionCompat$Callback.onStop()> return; // 113 353:return case 14: // '\016' callback.onSkipToNext(); // 114 354:aload_2 // 115 355:invokevirtual #136 <Method void MediaSessionCompat$Callback.onSkipToNext()> return; // 116 358:return case 15: // '\017' callback.onSkipToPrevious(); // 117 359:aload_2 // 118 360:invokevirtual #141 <Method void MediaSessionCompat$Callback.onSkipToPrevious()> return; // 119 363:return case 16: // '\020' callback.onFastForward(); // 120 364:aload_2 // 121 365:invokevirtual #149 <Method void MediaSessionCompat$Callback.onFastForward()> return; // 122 368:return case 17: // '\021' callback.onRewind(); // 123 369:aload_2 // 124 370:invokevirtual #154 <Method void MediaSessionCompat$Callback.onRewind()> return; // 125 373:return case 18: // '\022' callback.onSeekTo(((Long)message.obj).longValue()); // 126 374:aload_2 // 127 375:aload_1 // 128 376:getfield #169 <Field Object Message.obj> // 129 379:checkcast #238 <Class Long> // 130 382:invokevirtual #241 <Method long Long.longValue()> // 131 385:invokevirtual #248 <Method void MediaSessionCompat$Callback.onSeekTo(long)> return; // 132 388:return case 19: // '\023' callback.onSetRating((RatingCompat)message.obj); // 133 389:aload_2 // 134 390:aload_1 // 135 391:getfield #169 <Field Object Message.obj> // 136 394:checkcast #250 <Class RatingCompat> // 137 397:invokevirtual #254 <Method void MediaSessionCompat$Callback.onSetRating(RatingCompat)> return; // 138 400:return case 31: // '\037' callback.onSetRating((RatingCompat)message.obj, message.getData()); // 139 401:aload_2 // 140 402:aload_1 // 141 403:getfield #169 <Field Object Message.obj> // 142 406:checkcast #250 <Class RatingCompat> // 143 409:aload_1 // 144 410:invokevirtual #214 <Method Bundle Message.getData()> // 145 413:invokevirtual #257 <Method void MediaSessionCompat$Callback.onSetRating(RatingCompat, Bundle)> return; // 146 416:return case 20: // '\024' callback.onCustomAction((String)message.obj, message.getData()); // 147 417:aload_2 // 148 418:aload_1 // 149 419:getfield #169 <Field Object Message.obj> // 150 422:checkcast #210 <Class String> // 151 425:aload_1 // 152 426:invokevirtual #214 <Method Bundle Message.getData()> // 153 429:invokevirtual #260 <Method void MediaSessionCompat$Callback.onCustomAction(String, Bundle)> return; // 154 432:return case 25: // '\031' callback.onAddQueueItem((MediaDescriptionCompat)message.obj); // 155 433:aload_2 // 156 434:aload_1 // 157 435:getfield #169 <Field Object Message.obj> // 158 438:checkcast #262 <Class MediaDescriptionCompat> // 159 441:invokevirtual #266 <Method void MediaSessionCompat$Callback.onAddQueueItem(MediaDescriptionCompat)> return; // 160 444:return case 26: // '\032' callback.onAddQueueItem((MediaDescriptionCompat)message.obj, message.arg1); // 161 445:aload_2 // 162 446:aload_1 // 163 447:getfield #169 <Field Object Message.obj> // 164 450:checkcast #262 <Class MediaDescriptionCompat> // 165 453:aload_1 // 166 454:getfield #269 <Field int Message.arg1> // 167 457:invokevirtual #272 <Method void MediaSessionCompat$Callback.onAddQueueItem(MediaDescriptionCompat, int)> return; // 168 460:return case 27: // '\033' callback.onRemoveQueueItem((MediaDescriptionCompat)message.obj); // 169 461:aload_2 // 170 462:aload_1 // 171 463:getfield #169 <Field Object Message.obj> // 172 466:checkcast #262 <Class MediaDescriptionCompat> // 173 469:invokevirtual #275 <Method void MediaSessionCompat$Callback.onRemoveQueueItem(MediaDescriptionCompat)> return; // 174 472:return case 28: // '\034' if(mQueue != null) break MISSING_BLOCK_LABEL_483; // 175 473:aload_0 // 176 474:getfield #83 <Field MediaSessionCompat$MediaSessionImplBase this$0> // 177 477:getfield #279 <Field List MediaSessionCompat$MediaSessionImplBase.mQueue> // 178 480:ifnull 12 break; } if(true) goto _L1; else goto _L3 _L3: break; /* Loop/switch isn't completed */ if(message.arg1 >= 0 && message.arg1 < mQueue.size()) //* 179 483:aload_1 //* 180 484:getfield #269 <Field int Message.arg1> //* 181 487:iflt 542 //* 182 490:aload_1 //* 183 491:getfield #269 <Field int Message.arg1> //* 184 494:aload_0 //* 185 495:getfield #83 <Field MediaSessionCompat$MediaSessionImplBase this$0> //* 186 498:getfield #279 <Field List MediaSessionCompat$MediaSessionImplBase.mQueue> //* 187 501:invokeinterface #284 <Method int List.size()> //* 188 506:icmpge 542 message = ((Message) ((MediaSessionCompat.QueueItem)mQueue.get(message.arg1))); // 189 509:aload_0 // 190 510:getfield #83 <Field MediaSessionCompat$MediaSessionImplBase this$0> // 191 513:getfield #279 <Field List MediaSessionCompat$MediaSessionImplBase.mQueue> // 192 516:aload_1 // 193 517:getfield #269 <Field int Message.arg1> // 194 520:invokeinterface #288 <Method Object List.get(int)> // 195 525:checkcast #290 <Class MediaSessionCompat$QueueItem> // 196 528:astore_1 else //* 197 529:aload_1 //* 198 530:ifnull 12 //* 199 533:aload_2 //* 200 534:aload_1 //* 201 535:invokevirtual #294 <Method MediaDescriptionCompat MediaSessionCompat$QueueItem.getDescription()> //* 202 538:invokevirtual #275 <Method void MediaSessionCompat$Callback.onRemoveQueueItem(MediaDescriptionCompat)> //* 203 541:return message = null; // 204 542:aconst_null // 205 543:astore_1 if(message != null) { callback.onRemoveQueueItem(((MediaSessionCompat.QueueItem) (message)).getDescription()); return; } if(true) goto _L1; else goto _L4 // 206 544:goto 529 _L4: adjustVolume(message.arg1, 0); // 207 547:aload_0 // 208 548:getfield #83 <Field MediaSessionCompat$MediaSessionImplBase this$0> // 209 551:aload_1 // 210 552:getfield #269 <Field int Message.arg1> // 211 555:iconst_0 // 212 556:invokevirtual #298 <Method void MediaSessionCompat$MediaSessionImplBase.adjustVolume(int, int)> return; // 213 559:return setVolumeTo(message.arg1, 0); // 214 560:aload_0 // 215 561:getfield #83 <Field MediaSessionCompat$MediaSessionImplBase this$0> // 216 564:aload_1 // 217 565:getfield #269 <Field int Message.arg1> // 218 568:iconst_0 // 219 569:invokevirtual #301 <Method void MediaSessionCompat$MediaSessionImplBase.setVolumeTo(int, int)> return; // 220 572:return callback.onSetCaptioningEnabled(((Boolean)message.obj).booleanValue()); // 221 573:aload_2 // 222 574:aload_1 // 223 575:getfield #169 <Field Object Message.obj> // 224 578:checkcast #303 <Class Boolean> // 225 581:invokevirtual #307 <Method boolean Boolean.booleanValue()> // 226 584:invokevirtual #311 <Method void MediaSessionCompat$Callback.onSetCaptioningEnabled(boolean)> return; // 227 587:return callback.onSetRepeatMode(message.arg1); // 228 588:aload_2 // 229 589:aload_1 // 230 590:getfield #269 <Field int Message.arg1> // 231 593:invokevirtual #315 <Method void MediaSessionCompat$Callback.onSetRepeatMode(int)> return; // 232 596:return callback.onSetShuffleModeEnabled(((Boolean)message.obj).booleanValue()); // 233 597:aload_2 // 234 598:aload_1 // 235 599:getfield #169 <Field Object Message.obj> // 236 602:checkcast #303 <Class Boolean> // 237 605:invokevirtual #307 <Method boolean Boolean.booleanValue()> // 238 608:invokevirtual #318 <Method void MediaSessionCompat$Callback.onSetShuffleModeEnabled(boolean)> return; // 239 611:return callback.onSetShuffleMode(message.arg1); // 240 612:aload_2 // 241 613:aload_1 // 242 614:getfield #269 <Field int Message.arg1> // 243 617:invokevirtual #321 <Method void MediaSessionCompat$Callback.onSetShuffleMode(int)> return; // 244 620:return } public void post(int i) { post(i, ((Object) (null))); // 0 0:aload_0 // 1 1:iload_1 // 2 2:aconst_null // 3 3:invokevirtual #325 <Method void post(int, Object)> // 4 6:return } public void post(int i, Object obj) { obtainMessage(i, obj).sendToTarget(); // 0 0:aload_0 // 1 1:iload_1 // 2 2:aload_2 // 3 3:invokevirtual #329 <Method Message obtainMessage(int, Object)> // 4 6:invokevirtual #332 <Method void Message.sendToTarget()> // 5 9:return } public void post(int i, Object obj, int j) { obtainMessage(i, j, 0, obj).sendToTarget(); // 0 0:aload_0 // 1 1:iload_1 // 2 2:iload_3 // 3 3:iconst_0 // 4 4:aload_2 // 5 5:invokevirtual #336 <Method Message obtainMessage(int, int, int, Object)> // 6 8:invokevirtual #332 <Method void Message.sendToTarget()> // 7 11:return } public void post(int i, Object obj, Bundle bundle) { obj = ((Object) (obtainMessage(i, obj))); // 0 0:aload_0 // 1 1:iload_1 // 2 2:aload_2 // 3 3:invokevirtual #329 <Method Message obtainMessage(int, Object)> // 4 6:astore_2 ((Message) (obj)).setData(bundle); // 5 7:aload_2 // 6 8:aload_3 // 7 9:invokevirtual #341 <Method void Message.setData(Bundle)> ((Message) (obj)).sendToTarget(); // 8 12:aload_2 // 9 13:invokevirtual #332 <Method void Message.sendToTarget()> // 10 16:return } private static final int KEYCODE_MEDIA_PAUSE = 127; private static final int KEYCODE_MEDIA_PLAY = 126; private static final int MSG_ADD_QUEUE_ITEM = 25; private static final int MSG_ADD_QUEUE_ITEM_AT = 26; private static final int MSG_ADJUST_VOLUME = 2; private static final int MSG_COMMAND = 1; private static final int MSG_CUSTOM_ACTION = 20; private static final int MSG_FAST_FORWARD = 16; private static final int MSG_MEDIA_BUTTON = 21; private static final int MSG_NEXT = 14; private static final int MSG_PAUSE = 12; private static final int MSG_PLAY = 7; private static final int MSG_PLAY_MEDIA_ID = 8; private static final int MSG_PLAY_SEARCH = 9; private static final int MSG_PLAY_URI = 10; private static final int MSG_PREPARE = 3; private static final int MSG_PREPARE_MEDIA_ID = 4; private static final int MSG_PREPARE_SEARCH = 5; private static final int MSG_PREPARE_URI = 6; private static final int MSG_PREVIOUS = 15; private static final int MSG_RATE = 19; private static final int MSG_RATE_EXTRA = 31; private static final int MSG_REMOVE_QUEUE_ITEM = 27; private static final int MSG_REMOVE_QUEUE_ITEM_AT = 28; private static final int MSG_REWIND = 17; private static final int MSG_SEEK_TO = 18; private static final int MSG_SET_CAPTIONING_ENABLED = 29; private static final int MSG_SET_REPEAT_MODE = 23; private static final int MSG_SET_SHUFFLE_MODE = 30; private static final int MSG_SET_SHUFFLE_MODE_ENABLED = 24; private static final int MSG_SET_VOLUME = 22; private static final int MSG_SKIP_TO_ITEM = 11; private static final int MSG_STOP = 13; final MediaSessionCompat.MediaSessionImplBase this$0; public MediaSessionCompat$MediaSessionImplBase$MessageHandler(Looper looper) { this$0 = MediaSessionCompat.MediaSessionImplBase.this; // 0 0:aload_0 // 1 1:aload_1 // 2 2:putfield #83 <Field MediaSessionCompat$MediaSessionImplBase this$0> super(looper); // 3 5:aload_0 // 4 6:aload_2 // 5 7:invokespecial #86 <Method void Handler(Looper)> // 6 10:return } }