text:
package maintenance

import (
	"encoding/json"
	"fmt"
	"io/ioutil"
	"net/http"
	"os"
	"reflect"
	"strings"
	"testing"
)

func stacks() []string {
	return []string{
		"linux-docker-android-lts",
		"linux-docker-android",
		"osx-vs4mac-beta",
		"osx-vs4mac-previous-stable",
		"osx-vs4mac-stable",
		"osx-xcode-10.1.x",
		"osx-xcode-10.2.x",
		"osx-xcode-10.3.x",
		"osx-xcode-11.0.x",
		"osx-xcode-11.1.x",
		"osx-xcode-11.2.x",
		"osx-xcode-11.3.x",
		"osx-xcode-11.4.x",
		"osx-xcode-11.5.x",
		"osx-xcode-11.6.x",
		"osx-xcode-11.7.x",
		"osx-xcode-12.0.x",
		"osx-xcode-12.1.x",
		"osx-xcode-12.2.x",
		"osx-xcode-12.3.x",
		"osx-xcode-12.4.x",
		"osx-xcode-12.5.x",
		"osx-xcode-9.4.x",
		"osx-xcode-edge",
	}
}

type report struct {
	Name string `json:"name"`
}

type systemReports []report

func (reports systemReports) Stacks() (s []string) {
	for _, report := range reports {
		s = append(s, strings.TrimSuffix(report.Name, ".log"))
	}
	return
}

func TestStackChange(t *testing.T) {
	req, err := http.NewRequest(http.MethodGet, "https://api.github.com/repos/bitrise-io/bitrise.io/contents/system_reports", nil)
	if err != nil {
		t.Fatalf("setup: faile to create request: %s", err)
	}

	token := os.Getenv("GIT_BOT_USER_ACCESS_TOKEN")
	if token != "" {
		req.Header.Set("Authorization", fmt.Sprintf("token %s", os.Getenv("GIT_BOT_USER_ACCESS_TOKEN")))
	}

	resp, err := http.DefaultClient.Do(req)
	if err != nil {
		t.Fatalf("Error getting current stack list from GitHub: %s", err)
	}
	defer func() {
		if err := resp.Body.Close(); err != nil {
			t.Fatalf("Error closing response body")
		}
	}()

	bytes, err := ioutil.ReadAll(resp.Body)
	if err != nil {
		t.Fatalf("Error reading stack info from GitHub response: %s", err)
	}

	var reports systemReports
	if err := json.Unmarshal(bytes, &reports); err != nil {
		t.Fatalf("Error unmarshalling stack data from string (%s): %s", bytes, err)
	}

	if expected := reports.Stacks(); !reflect.DeepEqual(expected, stacks()) {
		t.Fatalf("Stack list changed, current: %v, expecting: %v", stacks(), expected)
	}
}


text:
require ${PN}.inc

PR = "r0"

SRC_URI = "${HANDHELDS_CVS};tag=${TAG};module=opie/inputmethods/multikey \
           ${HANDHELDS_CVS};tag=${TAG};module=opie/share \
           file://fix-rpath.patch;patch=1"

#           file://friendly-button-names.patch;patch=1"

license: MIT

license_type: permissive

branch_name: refs/heads/master

extension: bb


text:
require wpebackend-fdo.inc
require conf/include/devupstream.inc

DEFAULT_PREFERENCE = "-1"

SRC_URI = "git://github.com/Igalia/WPEBackend-fdo.git;protocol=https;branch=master"
SRCREV = "f2901c6ed7f720a578bfd5830d12426c979c0afa"
S = "${WORKDIR}/git"

repository: YoeDistro/meta-webkit

repo_name: YoeDistro/meta-webkit

gha_license_id: MIT


text:
@book{moens,
    place={Oxfordshire, UK},
    edition={2},
    year = {2013},
    title={Plant Nematology},
    publisher={CAB International},
    editor={Perry, Roland; Maurice Moens Editor}}

@article{jones2013top,
  title={Top 10 plant-parasitic nematodes in molecular plant pathology},
  author={Jones, John T and Haegeman, Annelies and Danchin, Etienne GJ and Gaur, Hari S and Helder, Johannes and Jones, Michael GK and Kikuchi, Taisei and Manzanilla-L{\'o}pez, Rosa and Palomares-Rius, Juan E and Wesemael, Wim ML and others},
  journal={Molecular plant pathology},
  volume={14},
  number={9},
  pages={946--961},
  year={2013},
  publisher={Wiley Online Library},
  doi = {10.1111/mpp.12057}
}

@incollection{yeates1987plants,
  title={How plants affect nematodes},
  author={Yeates, GW},
  booktitle={Advances in ecological research},
  volume={17},
  pages={61--113},
  year={1987},
  publisher={Elsevier},
  doi = {10.1016/S0065-2504(08)60244-5}
}

@article{williamson2006nematode,
  title={Nematode resistance in plants: the battle underground},
  author={Williamson, Valerie M and Kumar, Amar},
  journal={TRENDS in Genetics},
  volume={22},
  number={7},
  pages={396--403},
  year={2006},
  publisher={Elsevier},
  doi = {10.1016/j.tig.2006.05.003}
}

@article{opperman1998soybean,
  title={The soybean cyst nematode, Heterodera glycines: a genetic model system for the study of plant-parasitic nematodes},
  author={Opperman, Charles H and Bird, David McK},
  journal={Current opinion in plant biology},
  volume={1},
  number={4},
  pages={342--346},
  year={1998},
  publisher={Elsevier Science}
}

@article{stone1985co,
  title={Co-evolution of potato cyst nematodes and their hosts: implications for pathotypes and resistance 1},
  author={Stone, AR},
  journal={EPPO Bulletin},
  volume={15},
  number={2},
  pages={131--137},
  year={1985},
  publisher={Wiley Online Library},
  doi = {10.1111/j.1365-2338.1985.tb00212.x}
}

@article{zacheo1995plant,
  title={Plant-nematode interactions: Histological, physiological and biochemical interactions},
  author={Zacheo, GIUSEPPE and Bleve-Zacheo, TERESA},
  journal={Pathogenesis and host specificity in plant diseases: Histopathological, biochemical, genetic and molecular bases},
  volume={3},
  pages={321--353},
  year={1995}
}

@incollection{mantelin2015suppression,
  title={Suppression of plant defences by plant-parasitic nematodes},
  author={Mantelin, Sophie and Thorpe, Peter and Jones, John T},
  booktitle={Advances in botanical research},
  volume={73},
  pages={325--337},
  year={2015},
  publisher={Elsevier},
  doi = {10.1016/bs.abr.2014.12.011}
}

@article{vanholme2004secretions,
  title={Secretions of plant-parasitic nematodes: a molecular update},
  author={Vanholme, Bartel and De Meutter, Jan and Tytgat, Tom and Van Montagu, Marc and Coomans, August and Gheysen, Godelieve},
  journal={Gene},
  volume={332},
  pages={13--27},
  year={2004},
  publisher={Elsevier},
  doi = {10.1016/j.gene.2004.02.024}
}

@incollection{de2015plant,
  title={The plant cell cycle machinery: Usurped and modulated by plant-parasitic nematodes},
  author={de Almeida Engler, Janice and Vieira, Paulo and Rodiuc, Natalia and de Sa, Maria Fatima Grossi and Engler, Gilbert},
  booktitle={Advances in botanical research},
  volume={73},
  pages={91--118},
  year={2015},
  publisher={Elsevier},
  doi = {10.1016/bs.abr.2014.12.003}
}

@article{mitchum2013nematode,
  title={Nematode effector proteins: an emerging paradigm of parasitism},
  author={Mitchum, Melissa G and Hussey, Richard S and Baum, Thomas J and Wang, Xiaohong and Elling, Axel A and Wubben, Martin and Davis, Eric L},
  journal={New Phytologist},
  volume={199},
  number={4},
  pages={879--894},
  year={2013},
  publisher={Wiley Online Library},
  doi = {10.1111/nph.12323}
}

@article{siddique2018parasitic,
  title={Parasitic nematodes manipulate plant development to establish feeding sites},
  author={Siddique, Shahid and Grundler, Florian MW},
  journal={Current opinion in microbiology},
  volume={46},
  pages={102--108},
  year={2018},
  publisher={Elsevier},
  doi = {10.1016/j.mib.2018.09.004}
}

@article{vieira2019plant,
  title={Plant-parasitic nematode effectors—insights into their diversity and new tools for their identification},
  author={Vieira, Paulo and Gleason, Cynthia},
  journal={Current Opinion in Plant Biology},
  volume={50},
  pages={37--43},
  year={2019},
  publisher={Elsevier},
  doi = {10.1016/j.pbi.2019.02.007}
}

@incollection{siddique2015metabolism,
  title={Metabolism in nematode feeding sites},
  author={Siddique, Shahid and Grundler, Florian MW},
  booktitle={Advances in Botanical Research},
  volume={73},
  pages={119--138},
  year={2015},
  publisher={Elsevier},
  doi = {10.1016/bs.abr.2015.02.001}
}

@article{bartlem2013vascularization,
  title={Vascularization and nutrient delivery at root-knot nematode feeding sites in host roots},
  author={Bartlem, Derek G and Jones, Michael GK and Hammes, Ulrich Z},
  journal={Journal of Experimental Botany},
  volume={65},
  number={7},
  pages={1789--1798},
  year={2013},
  publisher={Oxford University Press},
  doi = {10.1093/jxb/ert415}
}

@article{eloh2016untargeted,
  title={Untargeted metabolomics of tomato plants after root-knot nematode infestation},
  author={Eloh, Kodjo and Sasanelli, Nicola and Maxia, Andrea and Caboni, Pierluigi},
  journal={Journal of agricultural and food chemistry},
  volume={64},
  number={29},
  pages={5963--5968},
  year={2016},
  publisher={ACS Publications},
  doi = {10.1021/acs.jafc.6b02181}
}

@article{hofmann2010metabolic,
  title={Metabolic profiling reveals local and systemic responses of host plants to nematode parasitism},
  author={Hofmann, Julia and El Ashry, Abd El Naser and Anwar, Shahbaz and Erban, Alexander and Kopka, Joachim and Grundler, Florian},
  journal={The Plant Journal},
  volume={62},
  number={6},
  pages={1058--1071},
  year={2010},
  publisher={Wiley Online Library},
  doi = {10.1111/j.1365-313X.2010.04217.x}
}

@article{sijmons1994parasitic,
  title={Parasitic strategies of root nematodes and associated host cell responses},
  author={Sijmons, PC and Atkinson, HJ and Wyss, U},
  journal={Annual review of phytopathology},
  volume={32},
  number={1},
  pages={235--259},
  year={1994},
  publisher={Annual Reviews 4139 El Camino Way, PO Box 10139, Palo Alto, CA 94303-0139, USA}
}

@article{kutsuwa2015belonolaimus,
  title={Belonolaimus longicaudatus: An emerging pathogen of peanut in Florida},
  author={Kutsuwa, Kanan and Dickson, DW and Brito, JA and Jeyaprakash, A and Drew, A},
  journal={Journal of nematology},
  volume={47},
  number={2},
  pages={87},
  year={2015},
  publisher={Society of Nematologists}
}

@article{crow2000yield,
  title={Yield reduction and root damage to cotton induced by Belonolaimus longicaudatus},
  author={Crow, WT and Dickson, DW and Weingartner, DP and McSorley, R and Miller, GL},
  journal={Journal of nematology},
  volume={32},
  number={2},
  pages={205},
  year={2000},
  publisher={Society of Nematologists}
}

@article{shaver2017damage,
  title={Damage Functions for Sting Nematode (Belonolaimus longicaudatus) on Bermudagrass Turf},
  author={Shaver, Bradly R and Agudelo, Paula and Martin, S Bruce},
  journal={International Turfgrass Society Research Journal},
  volume={13},
  number={1},
  pages={517--523},
  year={2017},
  publisher={International Turfgrass Society and ACSESS}
}

@article{bekal2000population,
  title={Population dynamics of the sting nematode in California turfgrass},
  author={Bekal, Sadia and Becker, J Ole},
  journal={Plant disease},
  volume={84},
  number={10},
  pages={1081--1084},
  year={2000},
  publisher={Am Phytopath Society}
}

@article{pang2011bermudagrass,
  title={Bermudagrass cultivar responses to sting nematodes},
  author={Pang, Wening and Luc, John E and Crow, William T and Kenworthy, Kevin E and Giblin-Davis, Robin M and McSorley, Robert and Kruse, Jason K},
  journal={Crop Science},
  volume={51},
  number={5},
  pages={2199--2203},
  year={2011},
  publisher={The Crop Science Society of America, Inc.}
}

@article{pang2011screening,
  title={Screening bermudagrass germplasm accessions for tolerance to sting nematodes},
  author={Pang, Wenjing and Luc, John E and Crow, William T and Kenworthy, Kevin E and McSorley, Robert and Giblin-Davis, Robin M},
  journal={HortScience},
  volume={46},
  number={11},
  pages={1503--1506},
  year={2011},
  publisher={American Society for Horticultural Science}
}

@article{valpuesta2004biosynthesis,
  title={Biosynthesis of L-ascorbic acid in plants: new pathways for an old antioxidant},
  author={Valpuesta, Victoriano and Botella, Miguel A},
  journal={Trends in plant science},
  volume={9},
  number={12},
  pages={573--577},
  year={2004},
  publisher={Elsevier},
  doi = {10.1016/j.tplants.2004.10.002}
}

@article{tolbert1997c2,
  title={The C2 oxidative photosynthetic carbon cycle},
  author={Tolbert, NE},
  journal={Annual review of plant biology},
  volume={48},
  number={1},
  pages={1--25},
  year={1997},
  publisher={Annual Reviews 4139 El Camino Way, PO Box 10139, Palo Alto, CA 94303-0139, USA}
}

@article{raskin1992role,
  title={Role of salicylic acid in plants},
  author={Raskin, Ilya},
  journal={Annual review of plant biology},
  volume={43},
  number={1},
  pages={439--463},
  year={1992},
  publisher={Annual Reviews 4139 El Camino Way, PO Box 10139, Palo Alto, CA 94303-0139, USA}
}

@article{delaney1994central,
  title={A central role of salicylic acid in plant disease resistance},
  author={Delaney, Terrence P and Uknes, Scott and Vernooij, Bernard and Friedrich, Leslie and Weymann, Kris and Negrotto, David and Gaffney, Thomas and Gut-Rella, Manuela and Kessmann, Helmut and Ward, Eric and others},
  journal={Science},
  volume={266},
  number={5188},
  pages={1247--1250},
  year={1994},
  publisher={American Association for the Advancement of Science},
  doi = {10.1126/science.266.5188.1247}
}

@article{mauch1996production,
  title={Production of salicylic acid precursors is a major function of phenylalanine ammonia-lyase in the resistance of Arabidopsis to Peronospora parasitica.},
  author={Mauch-Mani, Brigitte and Slusarenko, Alan J},
  journal={The Plant Cell},
  volume={8},
  number={2},
  pages={203--212},
  year={1996},
  publisher={Am Soc Plant Biol},
  doi = {10.1105/tpc.8.2.203}
}

@article{li2016performance,
  title={Performance evaluation and online realization of data-driven normalization methods used in LC/MS based untargeted metabolomics analysis},
  author={Li, Bo and Tang, Jing and Yang, Qingxia and Cui, Xuejiao and Li, Shuang and Chen, Sijie and Cao, Quanxing and Xue, Weiwei and Chen, Na and Zhu, Feng},
  journal={Scientific reports},
  volume={6},
  pages={38881},
  year={2016},
  publisher={Nature Publishing Group},
  doi = {10.1038/srep38881}
}

@article{armitage2015missing,
  title={Missing value imputation strategies for metabolomics data},
  author={Armitage, Emily Grace and Godzien, Joanna and Alonso-Herranz, Vanesa and L{\'o}pez-Gonz{\'a}lvez, {\'A}ngeles and Barbas, Coral},
  journal={Electrophoresis},
  volume={36},
  number={24},
  pages={3050--3060},
  year={2015},
  publisher={Wiley Online Library},
  doi = {10.1002/elps.201500352}
 }

@article{benjamini1995controlling,
  title={Controlling the false discovery rate: a practical and powerful approach to multiple testing},
  author={Benjamini, Yoav and Hochberg, Yosef},
  journal={Journal of the Royal statistical society: series B (Methodological)},
  volume={57},
  number={1},
  pages={289--300},
  year={1995},
  publisher={Wiley Online Library}
}

@article{sud2015metabolomics,
  title={Metabolomics Workbench: An international repository for metabolomics data and metadata, metabolite standards, protocols, tutorials and training, and analysis tools},
  author={Sud, Manish and Fahy, Eoin and Cotter, Dawn and Azam, Kenan and Vadivelu, Ilango and Burant, Charles and Edison, Arthur and Fiehn, Oliver and Higashi, Richard and Nair, K Sreekumaran and others},
  journal={Nucleic acids research},
  volume={44},
  number={D1},
  pages={D463--D470},
  year={2015},
  publisher={Oxford University Press},
  doi = {10.1093/nar/gkv1042}
}

@Manual{rcore2018,
    title = {R: A Language and Environment for Statistical Computing},
    author = {{R Core Team}},
    organization = {R Foundation for Statistical Computing},
    address = {Vienna, Austria},
    year = {2018},
    url = {https://www.R-project.org/},
  }

  @Manual{rstudio,
    title = {RStudio: Integrated Development Environment for R},
    author = {{RStudio Team}},
    organization = {RStudio, Inc.},
    address = {Boston, MA},
    year = {2016},
    url = {http://www.rstudio.com/},
  }

@article{wang2018pipecolic,
  title={Pipecolic acid confers systemic immunity by regulating free radicals},
  author={Wang, Caixia and Liu, Ruiying and Lim, Gah-Hyun and de Lorenzo, Laura and Yu, Keshun and Zhang, Kai and Hunt, Arthur G and Kachroo, Aardra and Kachroo, Pradeep},
  journal={Science advances},
  volume={4},
  number={5},
  pages={eaar4509},
  year={2018},
  publisher={American Association for the Advancement of Science},
  doi = {10.1126/sciadv.aar4509}
}

@article{shan2018pipped,
  title={Pipped at the Post: Pipecolic Acid Derivative Identified as SAR Regulator},
  author={Shan, Libo and He, Ping},
  journal={Cell},
  volume={173},
  number={2},
  pages={286--287},
  year={2018},
  publisher={Elsevier},
  doi = {10.1016/j.cell.2018.03.045}
}

@article{uehara2010resistant,
  title={Resistant and susceptible responses in tomato to cyst nematode are differentially regulated by salicylic acid},
  author={Uehara, Taketo and Sugiyama, Shunpei and Matsuura, Hideyuki and Arie, Tsutomu and Masuta, Chikara},
  journal={Plant and cell physiology},
  volume={51},
  number={9},
  pages={1524--1536},
  year={2010},
  publisher={Oxford University Press},
  doi = {10.1093/pcp/pcq109}
}

@article{martinez2017shifting,
  title={Shifting from priming of salicylic acid-to jasmonic acid-regulated defences by Trichoderma protects tomato against the root knot nematode Meloidogyne incognita},
  author={Mart{\'\i}nez-Medina, Ainhoa and Fernandez, Ivan and Lok, Gerrit B and Pozo, Mar{\'\i}a J and Pieterse, Corn{\'e} MJ and Van Wees, Saskia},
  journal={New Phytologist},
  volume={213},
  number={3},
  pages={1363--1377},
  year={2017},
  publisher={Wiley Online Library},
  doi = {10.1111/nph.14251}
}

@article{crow2001sting,
  title={Sting nematode, Belonolaimus longicaudatus Rau Nematoda: Secernentea: Tylenchida: Tylenchina: Belonolaimidae: Belonlaiminae},
  author={Crow, WT and Brammer, A},
  journal={Entomology and Nematology Department, University of Florida, Gainesville. EENY-239},
  year={2001},
  publisher={Citeseer}
}

@article{pang2011bermudagrass,
  title={Bermudagrass cultivar responses to sting nematodes},
  author={Pang, Wening and Luc, John E and Crow, William T and Kenworthy, Kevin E and Giblin-Davis, Robin M and McSorley, Robert and Kruse, Jason K},
  journal={Crop Science},
  volume={51},
  number={5},
  pages={2199--2203},
  year={2011},
  publisher={The Crop Science Society of America, Inc.}
}

repository: acetworld/bermuda-grass-metabolomics

repo_name: acetworld/bermuda-grass-metabolomics

extension: bib


text:
find_path(OPENZWAVE_INCLUDE_DIR
	NAMES Manager.h
	PATHS
		/usr/include/
		/usr/local/include/
	PATH_SUFFIXES openzwave
)
find_library(OPENZWAVE_LIBRARY
	NAMES openzwave
	PATHS
		/usr/lib
		/usr/lib64
		/usr/local/lib
		/usr/local/lib64
)

include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(OpenZWave
	FOUND_VAR OPENZWAVE_FOUND
	REQUIRED_VARS
		OPENZWAVE_LIBRARY
		OPENZWAVE_INCLUDE_DIR
)

if(OPENZWAVE_FOUND)
	set(OPENZWAVE_INCLUDE_DIR ${OPENZWAVE_INCLUDE_DIR})
	set(OPENZWAVE_LIBRARY ${OPENZWAVE_LIBRARY})
endif()

repository: BeeeOn/gateway

repo_name: BeeeOn/gateway

extension: cmake


text:
# base recipe: https://github.com/sysmocom/meta-telephony/tree/master/recipes-misc/libdbi/libdbi.inc
# base branch: master

# libdbi OE build file
# Copyright (C) 2005, Koninklijke Philips Electronics NV.  All Rights Reserved
# Released under the MIT license (see packages/COPYING)

PR = "r0"

inherit debian-package

DESCRIPTION = "Database Independent Abstraction Layer for C"
HOMEPAGE = "http://libdbi.sourceforge.net/"

LICENSE = "LGPLv2.1+"
LIC_FILES_CHKSUM = "file://COPYING;md5=d8045f3b8f929c1cb29a1e3fd737b499"

SECTION = "libs"

inherit autotools

EXTRA_OECONF = "--disable-docs"

do_configure () {
	autotools_do_configure
}

repository: nghiaht-tsdv/meta-debian

repo_name: nghiaht-tsdv/meta-debian

branch_name: refs/heads/jethro

gha_language: BitBake


text:
package controllers

import (
	"bytes"
	"encoding/json"
	"github.com/astaxie/beego/orm"
	"io/ioutil"
	"net/http"
	"strconv"
	"strings"
	"time"
	"tokensky_bg_admin/common"
	"tokensky_bg_admin/conf"
	"tokensky_bg_admin/enums"
	"tokensky_bg_admin/models"
	"tokensky_bg_admin/utils"
)

//提币审核
type TokenskyUserTibiController struct {
	BaseController
}

//Prepare 参考beego官方文档说明
func (c *TokenskyUserTibiController) Prepare() {
	//先执行
	c.BaseController.Prepare()
	//如果一个Controller的多数Action都需要权限控制，则将验证放到Prepare
	c.checkAuthor()
}

// DataGrid
func (c *TokenskyUserTibiController) DataGrid() {
	//直接反序化获取json格式的requestbody里的值
	var params models.TokenskyUserTibiQueryParam
	switch c.Ctx.Request.Method {
	case "POST":
		json.Unmarshal(c.Ctx.Input.RequestBody, &params)
	case "GET":
		params.Sort = c.GetString("sort")
		params.Order = c.GetString("order")
		params.Limit, _ = c.GetInt64("limit")
		params.Offset, _ = c.GetInt64("offset")
		params.Status = c.GetString("status")
		params.StartTime, _ = c.GetInt64("startTime")
		params.EndTime, _ = c.GetInt64("endTime")
		params.Phone = c.GetString("phone")
		params.CoinType = c.GetString("coinType")
		params.OutAddress = c.GetString("outAddress")
		params.InAddress = c.GetString("inAddress")
	}
	//获取数据列表和总数
	data, total := models.TokenskyUserTibiPageList(&params)
	//定义返回的数据结构
	mapp := map[string]interface{}{
		"rows":  data,
		"total": total,
	}
	c.jsonResult(enums.JRCodeSucc, "", mapp)
}

//审核
func (c *TokenskyUserTibiController) Examine() {
	mapp := make(map[string]string)
	body := c.Ctx.Input.RequestBody //接收raw body内容
	if err := json.Unmarshal(body, &mapp); err != nil {
		c.jsonResult(enums.JRCodeFailed, "数据异常", 0)
	}
	ids := strings.Split(mapp["ids"], ",")

	var status int
	if con, err := strconv.Atoi(mapp["status"]); err == nil {
		status = con
	} else {
		c.jsonResult(enums.JRCodeFailed, "数据异常", 0)
	}
	data, total := models.TokenskyUserTibiByIds(ids)
	if total == 0 {
		c.jsonResult(enums.JRCodeFailed, "数据不存在", 0)
	}

	//1状态校验
	var con int
	for i, obj := range data {
		switch i {
		case 0:
			con = obj.Status
		default:
			if con != obj.Status {
				c.jsonResult(enums.JRCodeFailed, "数据状态不统一", obj.KeyId)
			}
		}
	}
	//提币
	switch status {
	case 1, 3:
		//审核通过
		client := &http.Client{}

		for _, obj := range data {
			url := conf.JIANG_SERVER_URL + "/service/" + obj.CoinType + "/withdraw"
			if obj.Quantity < obj.ServiceCharge {
				//提币数量小于手续费
				continue
			}
			//开启事务
			o := orm.NewOrm()
			err := o.Begin()
			if err != nil {
				//开启事务失败
				c.jsonResultError2(enums.JRCodeError, "开启事务失败")
			}
			//状态只有0 和 3 可以继续
			obj = models.TokenskyUserTibiById2(o, obj.KeyId)
			if obj.Status != 0 && obj.Status != 3 {
				o.Rollback()
				continue
			}

			//withdraw:
			//	amount 提币数量
			//	withdraw_id 请求发起方填的提现id，不能重复
			//	to 提现目标地址

			mapp := map[string]interface{}{
				"withdraw_id": obj.KeyId,                                      //请求的提现id
				"amount":      strconv.FormatFloat(obj.Quantity, 'E', -1, 64), //数额
				"to":          obj.InAddress,                                  //地址
			}
			bytesData, err := json.Marshal(mapp)
			reader := bytes.NewReader(bytesData)
			request, err := http.NewRequest("POST", url, reader)
			if err != nil && request != nil {
				o.Rollback()
				c.jsonResult(enums.JRCodeFailed, "创建请求对象失败", obj.KeyId)
			}
			request.Header.Set("Content-type", "application/json")
			response, err := client.Do(request)
			if err != nil {
				o.Rollback()
				c.jsonResult(enums.JRCodeFailed, "连接API失败", obj.KeyId)
			}
			body, err := ioutil.ReadAll(response.Body)
			//数据返回异常
			if err != nil {
				o.Rollback()
				c.jsonResult(enums.JRCodeFailed, "加载数据失败", obj.KeyId)
			}
			req := make(map[string]interface{})
			err = json.Unmarshal(body, &req)
			//状态
			code2, ok := req["code"].(float64)
			code := int(code2)
			//数据解析失败
			if !ok {
				o.Rollback()
				c.jsonResult(enums.JRCodeFailed, "审核表返回状态解析异常", obj.KeyId)
			}
			//通过人Id记录
			if obj.AdminId == 0 {
				obj.AdminId = c.curUser.Id
				obj.VerifyTime = time.Now()
			}

			/*提币审核日志*/
			logData := map[string]interface{}{
				"操作":    "提币审核(通过)",
				"审核状态":  obj.Status,
				"admin": c.curUser.Id,
				"用户":    obj.User.UserId,
				"提币单号":  obj.OrderId,
				"提币类型":  obj.CoinType,
				"提币金额":  obj.Quantity,
				"提币手续费": obj.ServiceChargeQuantity,
				"响应状态":  code,
			}
			logStr, _ := json.Marshal(logData)
			utils.LogNotice(logStr)
			//状态码
			switch code {
			case conf.TIBI_ERR_SUCCESS:
				//成功
				obj.Status = 3
				if _, err := o.Update(obj); err != nil {
					o.Rollback()
					c.jsonResult(enums.JRCodeFailed, "状态更新失败", obj.KeyId)
				}
				o.Commit()
				//极光推送状态
				models.TokenskyJiguangRegistrationidSendByOne(obj.User.UserId,"提币审核通过",obj.OrderId,"提币审核通过",obj.OrderId)
			case conf.TIBI_ERR_BAD_PARAMETER:
				//参数错误
				obj.Status = 4
				if _, err := o.Update(obj); err != nil {
					o.Rollback()
					c.jsonResult(enums.JRCodeFailed, "状态更新失败", obj.KeyId)
				}
				o.Commit()
				c.jsonResult(enums.JRCodeFailed, "参数异常", obj.KeyId)
			case conf.TIBI_ERR_SERVER_ERROR:
				//服务器错误
				o.Rollback()
				c.jsonResult(enums.JRCodeFailed, "服务器错误，请稍等尝试", obj.KeyId)
			case conf.TIBI_ERR_WITHDRAW_EXISTED:
				//重复申请
				o.Rollback()
				c.jsonResult(enums.JRCodeFailed, "提币订单已在申请中", obj.KeyId)
			case conf.TIBI_ERR_INVALID_ADDRESS:
				//无效地址
				o.Rollback()
				c.jsonResult(enums.JRCodeFailed, "无效地址", obj.KeyId)
			case conf.TIBI_ERR_INVALID_AMOUNT:
				//无效金额
				o.Rollback()
				c.jsonResult(enums.JRCodeFailed, "无效金额", obj.KeyId)
			default:
				o.Rollback()
				if _, err := o.Update(obj); err != nil {
					o.Rollback()
					c.jsonResult(enums.JRCodeFailed, "状态更新失败", obj.KeyId)
				}
				o.Commit()
				c.jsonResult(enums.JRCodeFailed, "未知异常", obj.KeyId)
			}
		}
	case 2:
		//审核未通过
		for _, obj := range data {
			//审核中的无法选择审核未通过
			switch obj.Status {
			case 3:
				continue
			}
			//通过人Id记录
			if obj.AdminId == 0 {
				obj.AdminId = c.curUser.Id
				obj.VerifyTime = time.Now()
			}
			//用户资产表 资产一定存在
			o := orm.NewOrm()
			err := o.Begin()
			if err != nil {
				c.jsonResult(enums.JRCodeFailed, "开启事务失败", 0)
			}
			balance := models.GetTokenskyUserBalanceByUidCoinType2(o, obj.User.UserId, obj.CoinType)
			if balance == nil {
				//用户资产表一定存在
				o.Rollback()
				continue
			}
			//
			obj = models.TokenskyUserTibiById2(o, obj.KeyId)
			if obj == nil {
				o.Rollback()
				continue
			}
			//状态校验
			if obj.Status != 0 {
				//已经通过审核过
				continue
			}
			//提币前资产
			logBalance := balance.Balance
			logFrozenBalance := balance.FrozenBalance
			//资产修改
			balanceChange := common.NewTokenskyUserBalanceChange(2,"tibi","提币")

			balance.FrozenBalance = utils.Float64Sub(balance.FrozenBalance, obj.SumQuantity)
			if balance.FrozenBalance < 0 {
				//资产负数
				o.Rollback()
				c.jsonResultError2(enums.JRCodeError, "扣除用户冻结资产，为负数")
			}

			obj.Status = 2
			//if _, err := o.Update(balance); err != nil {
			//	//资产表更新失败
			//	o.Rollback()
			//	c.jsonResult(enums.JRCodeFailed, "资产更新失败", obj.KeyId)
			//}
			if _, err := o.Update(obj); err != nil {
				//审核表保存失败
				if err := o.Rollback(); err != nil {
					c.jsonResult(enums.JRCodeFailed, "审核回滚失败", obj.KeyId)
				}
				c.jsonResult(enums.JRCodeFailed, "审核表保存失败", obj.KeyId)
			}
			balanceChange.Add(balance.UserId,balance.CoinType,
				obj.OrderId,"",0,
				conf.CHANGE_SUB,obj.SumQuantity,
				)

			//修改记录状态
			feeLog := models.TokenskyTransactionRecordOneByRelevance(o, "提币", "tibi", obj.OrderId)
			if feeLog == nil {
				//审核表保存失败
				if err := o.Rollback(); err != nil {
					c.jsonResult(enums.JRCodeFailed, "获取记录表回滚失败", obj.KeyId)
				}
				c.jsonResult(enums.JRCodeFailed, "获取记录表失败", obj.KeyId)
			}
			feeLog.Status = 2
			if _, err := o.Update(feeLog); err != nil {
				//记录表保存失败
				if err := o.Rollback(); err != nil {
					c.jsonResult(enums.JRCodeFailed, "记录表回滚失败", obj.KeyId)
				}
			}
			feeLog2 := models.TokenskyTransactionRecordOneByRelevance(o, "提币手续费", "tibi", obj.OrderId)
			if feeLog2 == nil {
				//审核表保存失败
				if err := o.Rollback(); err != nil {
					c.jsonResult(enums.JRCodeFailed, "获取记录表回滚失败2", obj.KeyId)
				}
				c.jsonResult(enums.JRCodeFailed, "获取记录表失败2", obj.KeyId)
			}
			feeLog2.Status = 2
			if _, err := o.Update(feeLog2); err != nil {
				//记录表保存失败
				if err := o.Rollback(); err != nil {
					c.jsonResult(enums.JRCodeFailed, "记录表回滚失败", obj.KeyId)
				}
			}
			//
			ok,msg,tx := balanceChange.Send()
			if !ok{
				o.Rollback()
				c.jsonResult(enums.JRCodeFailed, msg, obj.KeyId)
			}
			ok = models.TokenskyUserBalanceHashSetStatus(o,tx)
			if !ok{
				o.Rollback()
				c.jsonResult(enums.JRCodeFailed, "哈希表异常", obj.KeyId)
			}
			if err := o.Commit(); err != nil {
				c.jsonResult(enums.JRCodeFailed, "事务提交失败", obj.KeyId)
			}

			/* 提币详情日志 */
			logData := map[string]interface{}{
				"操作":      "提币审核(未通过)",
				"审核状态":    obj.Status,
				"admin":   c.curUser.Id,
				"用户":      balance.UserId,
				"提币单号":    obj.OrderId,
				"提币类型":    obj.CoinType,
				"提币金额":    obj.Quantity,
				"提币手续费":   obj.ServiceChargeQuantity,
				"提币前资产":   logBalance,
				"提币前冻结资产": logFrozenBalance,
				"提币后资产":   balance.Balance,
				"提币后冻结资产": balance.FrozenBalance,
			}
			logStr, _ := json.Marshal(logData)
			utils.LogNotice(logStr)
		}
	default:
		c.jsonResult(enums.JRCodeFailed, "状态异常", 0)
	}
	c.jsonResult(enums.JRCodeSucc, "审核完成", 0)
}

extension: go


text:
# Copyright (c) 2008,2009,2010, CodeSLoop Team
#
# 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.
#
# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 AUTHOR 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.

FIND_PATH(DLOPEN_INCLUDE_DIR dlfcn.h
  PATHS /usr/local/include /usr/include /sw/include /opt/local/include /opt/include )

FIND_LIBRARY(DLOPEN_LIBRARY NAMES dl
  PATH_SUFFIXES lib64 lib
  PATHS /usr/local /usr /sw /opt/local /opt )

SET(DLOPEN_FOUND "NO")

IF(DLOPEN_INCLUDE_DIR AND DLOPEN_LIBRARY)
   SET(DLOPEN_FOUND TRUE)
ELSE(DLOPEN_INCLUDE_DIR AND DLOPEN_LIBRARY)
   SET(DLOPEN_LIBRARY "")
   SET(DLOPEN_INCLUDE_DIR "")
ENDIF(DLOPEN_INCLUDE_DIR AND DLOPEN_LIBRARY)

IF(DLOPEN_FOUND)
  MESSAGE(STATUS "dlopen found: ${DLOPEN_LIBRARY}")
ELSE(DLOPEN_FOUND)
  MESSAGE(STATUS "dlopen NOT found")
ENDIF(DLOPEN_FOUND)

# -- EOF --

repository: codesloop/codesloop

repo_name: codesloop/codesloop


text:
// Code generated by pulumigen DO NOT EDIT.
// *** WARNING: Do not edit by hand unless you're certain you know what you are doing! ***

package v1beta1

import (
	"context"
	"reflect"

	"errors"
	"github.com/pulumi/pulumi-kubernetes/sdk/v4/go/kubernetes/internal"
	metav1 "github.com/pulumi/pulumi-kubernetes/sdk/v4/go/kubernetes/meta/v1"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

// CSIDriverList is a collection of CSIDriver objects.
type CSIDriverList struct {
	pulumi.CustomResourceState

	// APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources
	ApiVersion pulumi.StringOutput `pulumi:"apiVersion"`
	// items is the list of CSIDriver
	Items CSIDriverTypeArrayOutput `pulumi:"items"`
	// Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds
	Kind pulumi.StringOutput `pulumi:"kind"`
	// Standard list metadata More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata
	Metadata metav1.ListMetaOutput `pulumi:"metadata"`
}

// NewCSIDriverList registers a new resource with the given unique name, arguments, and options.
func NewCSIDriverList(ctx *pulumi.Context,
	name string, args *CSIDriverListArgs, opts ...pulumi.ResourceOption) (*CSIDriverList, error) {
	if args == nil {
		return nil, errors.New("missing one or more required arguments")
	}

	if args.Items == nil {
		return nil, errors.New("invalid value for required argument 'Items'")
	}
	args.ApiVersion = pulumi.StringPtr("storage.k8s.io/v1beta1")
	args.Kind = pulumi.StringPtr("CSIDriverList")
	opts = internal.PkgResourceDefaultOpts(opts)
	var resource CSIDriverList
	err := ctx.RegisterResource("kubernetes:storage.k8s.io/v1beta1:CSIDriverList", name, args, &resource, opts...)
	if err != nil {
		return nil, err
	}
	return &resource, nil
}

// GetCSIDriverList gets an existing CSIDriverList resource's state with the given name, ID, and optional
// state properties that are used to uniquely qualify the lookup (nil if not required).
func GetCSIDriverList(ctx *pulumi.Context,
	name string, id pulumi.IDInput, state *CSIDriverListState, opts ...pulumi.ResourceOption) (*CSIDriverList, error) {
	var resource CSIDriverList
	err := ctx.ReadResource("kubernetes:storage.k8s.io/v1beta1:CSIDriverList", name, id, state, &resource, opts...)
	if err != nil {
		return nil, err
	}
	return &resource, nil
}

// Input properties used for looking up and filtering CSIDriverList resources.
type csidriverListState struct {
}

type CSIDriverListState struct {
}

func (CSIDriverListState) ElementType() reflect.Type {
	return reflect.TypeOf((*csidriverListState)(nil)).Elem()
}

type csidriverListArgs struct {
	// APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources
	ApiVersion *string `pulumi:"apiVersion"`
	// items is the list of CSIDriver
	Items []CSIDriverType `pulumi:"items"`
	// Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds
	Kind *string `pulumi:"kind"`
	// Standard list metadata More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata
	Metadata *metav1.ListMeta `pulumi:"metadata"`
}

// The set of arguments for constructing a CSIDriverList resource.
type CSIDriverListArgs struct {
	// APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources
	ApiVersion pulumi.StringPtrInput
	// items is the list of CSIDriver
	Items CSIDriverTypeArrayInput
	// Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds
	Kind pulumi.StringPtrInput
	// Standard list metadata More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata
	Metadata metav1.ListMetaPtrInput
}

func (CSIDriverListArgs) ElementType() reflect.Type {
	return reflect.TypeOf((*csidriverListArgs)(nil)).Elem()
}

type CSIDriverListInput interface {
	pulumi.Input

	ToCSIDriverListOutput() CSIDriverListOutput
	ToCSIDriverListOutputWithContext(ctx context.Context) CSIDriverListOutput
}

func (*CSIDriverList) ElementType() reflect.Type {
	return reflect.TypeOf((**CSIDriverList)(nil)).Elem()
}

func (i *CSIDriverList) ToCSIDriverListOutput() CSIDriverListOutput {
	return i.ToCSIDriverListOutputWithContext(context.Background())
}

func (i *CSIDriverList) ToCSIDriverListOutputWithContext(ctx context.Context) CSIDriverListOutput {
	return pulumi.ToOutputWithContext(ctx, i).(CSIDriverListOutput)
}

// CSIDriverListArrayInput is an input type that accepts CSIDriverListArray and CSIDriverListArrayOutput values.
// You can construct a concrete instance of `CSIDriverListArrayInput` via:
//
//	CSIDriverListArray{ CSIDriverListArgs{...} }
type CSIDriverListArrayInput interface {
	pulumi.Input

	ToCSIDriverListArrayOutput() CSIDriverListArrayOutput
	ToCSIDriverListArrayOutputWithContext(context.Context) CSIDriverListArrayOutput
}

type CSIDriverListArray []CSIDriverListInput

func (CSIDriverListArray) ElementType() reflect.Type {
	return reflect.TypeOf((*[]*CSIDriverList)(nil)).Elem()
}

func (i CSIDriverListArray) ToCSIDriverListArrayOutput() CSIDriverListArrayOutput {
	return i.ToCSIDriverListArrayOutputWithContext(context.Background())
}

func (i CSIDriverListArray) ToCSIDriverListArrayOutputWithContext(ctx context.Context) CSIDriverListArrayOutput {
	return pulumi.ToOutputWithContext(ctx, i).(CSIDriverListArrayOutput)
}

// CSIDriverListMapInput is an input type that accepts CSIDriverListMap and CSIDriverListMapOutput values.
// You can construct a concrete instance of `CSIDriverListMapInput` via:
//
//	CSIDriverListMap{ "key": CSIDriverListArgs{...} }
type CSIDriverListMapInput interface {
	pulumi.Input

	ToCSIDriverListMapOutput() CSIDriverListMapOutput
	ToCSIDriverListMapOutputWithContext(context.Context) CSIDriverListMapOutput
}

type CSIDriverListMap map[string]CSIDriverListInput

func (CSIDriverListMap) ElementType() reflect.Type {
	return reflect.TypeOf((*map[string]*CSIDriverList)(nil)).Elem()
}

func (i CSIDriverListMap) ToCSIDriverListMapOutput() CSIDriverListMapOutput {
	return i.ToCSIDriverListMapOutputWithContext(context.Background())
}

func (i CSIDriverListMap) ToCSIDriverListMapOutputWithContext(ctx context.Context) CSIDriverListMapOutput {
	return pulumi.ToOutputWithContext(ctx, i).(CSIDriverListMapOutput)
}

type CSIDriverListOutput struct{ *pulumi.OutputState }

func (CSIDriverListOutput) ElementType() reflect.Type {
	return reflect.TypeOf((**CSIDriverList)(nil)).Elem()
}

func (o CSIDriverListOutput) ToCSIDriverListOutput() CSIDriverListOutput {
	return o
}

func (o CSIDriverListOutput) ToCSIDriverListOutputWithContext(ctx context.Context) CSIDriverListOutput {
	return o
}

// APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources
func (o CSIDriverListOutput) ApiVersion() pulumi.StringOutput {
	return o.ApplyT(func(v *CSIDriverList) pulumi.StringOutput { return v.ApiVersion }).(pulumi.StringOutput)
}

// items is the list of CSIDriver
func (o CSIDriverListOutput) Items() CSIDriverTypeArrayOutput {
	return o.ApplyT(func(v *CSIDriverList) CSIDriverTypeArrayOutput { return v.Items }).(CSIDriverTypeArrayOutput)
}

// Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds
func (o CSIDriverListOutput) Kind() pulumi.StringOutput {
	return o.ApplyT(func(v *CSIDriverList) pulumi.StringOutput { return v.Kind }).(pulumi.StringOutput)
}

// Standard list metadata More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata
func (o CSIDriverListOutput) Metadata() metav1.ListMetaOutput {
	return o.ApplyT(func(v *CSIDriverList) metav1.ListMetaOutput { return v.Metadata }).(metav1.ListMetaOutput)
}

type CSIDriverListArrayOutput struct{ *pulumi.OutputState }

func (CSIDriverListArrayOutput) ElementType() reflect.Type {
	return reflect.TypeOf((*[]*CSIDriverList)(nil)).Elem()
}

func (o CSIDriverListArrayOutput) ToCSIDriverListArrayOutput() CSIDriverListArrayOutput {
	return o
}

func (o CSIDriverListArrayOutput) ToCSIDriverListArrayOutputWithContext(ctx context.Context) CSIDriverListArrayOutput {
	return o
}

func (o CSIDriverListArrayOutput) Index(i pulumi.IntInput) CSIDriverListOutput {
	return pulumi.All(o, i).ApplyT(func(vs []interface{}) *CSIDriverList {
		return vs[0].([]*CSIDriverList)[vs[1].(int)]
	}).(CSIDriverListOutput)
}

type CSIDriverListMapOutput struct{ *pulumi.OutputState }

func (CSIDriverListMapOutput) ElementType() reflect.Type {
	return reflect.TypeOf((*map[string]*CSIDriverList)(nil)).Elem()
}

func (o CSIDriverListMapOutput) ToCSIDriverListMapOutput() CSIDriverListMapOutput {
	return o
}

func (o CSIDriverListMapOutput) ToCSIDriverListMapOutputWithContext(ctx context.Context) CSIDriverListMapOutput {
	return o
}

func (o CSIDriverListMapOutput) MapIndex(k pulumi.StringInput) CSIDriverListOutput {
	return pulumi.All(o, k).ApplyT(func(vs []interface{}) *CSIDriverList {
		return vs[0].(map[string]*CSIDriverList)[vs[1].(string)]
	}).(CSIDriverListOutput)
}

func init() {
	pulumi.RegisterInputType(reflect.TypeOf((*CSIDriverListInput)(nil)).Elem(), &CSIDriverList{})
	pulumi.RegisterInputType(reflect.TypeOf((*CSIDriverListArrayInput)(nil)).Elem(), CSIDriverListArray{})
	pulumi.RegisterInputType(reflect.TypeOf((*CSIDriverListMapInput)(nil)).Elem(), CSIDriverListMap{})
	pulumi.RegisterOutputType(CSIDriverListOutput{})
	pulumi.RegisterOutputType(CSIDriverListArrayOutput{})
	pulumi.RegisterOutputType(CSIDriverListMapOutput{})
}

repository: pulumi/pulumi-kubernetes

repo_name: pulumi/pulumi-kubernetes

gha_language: Java


text:
SUMMARY = "Sratom is a library for serialising LV2 atoms to and from RDF"
HOMEPAGE = "http://drobilla.net/software/sratom"
LICENSE = "MIT"
LIC_FILES_CHKSUM = "file://COPYING;md5=ebc7934238811c788037421c6c548ddf"

inherit waf pkgconfig

DEPENDS += "lv2 serd sord"

SRC_URI = "http://download.drobilla.net/${BPN}-${PV}.tar.bz2"
SRC_URI[md5sum] = "76f085e6d41bba57f4dc2a5ffeff9dde"
SRC_URI[sha256sum] = "440ac2b1f4f0b7878f8b95698faa1e8f8c50929a498f68ec5d066863626a3d43"


text:
SUMMARY = "NI-LinuxRT-specific glibc locale tests"
HOMEPAGE = "https://github.com/ni/meta-nilrt"
BUGTRACKER = "https://github.com/ni/meta-nilrt/issues"
SECTION = "tests"
LICENSE = "MIT"
LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/MIT;md5=0835ade698e0bcf8506ecda2f7b4f302"

DEPENDS = "glibc"

SRC_URI = "\
	file://run-ptest \
	file://test_locale_aliases.c \
	file://test_locale_aliases.sh \
	file://CP932.txt \
	file://CP936.txt \
	file://L1.txt \
"

S = "${WORKDIR}"

inherit ptest

CC += " ${LDFLAGS}"
debugsrcdir = "/usr/src/debug/${BPN}"

do_compile() {
	cd ${S}
	${CC} -o test_locale_aliases test_locale_aliases.c
}

do_install() {
	# source files
	install -d ${D}${debugsrcdir}
	install -m 0644 ${S}/*.c ${D}${debugsrcdir}/
}

do_install_ptest() {
	install -m 0755 ${S}/run-ptest                ${D}${PTEST_PATH}

	install -m 0755 ${S}/test_locale_aliases.sh   ${D}${PTEST_PATH}
	install -m 0755 ${S}/test_locale_aliases      ${D}${PTEST_PATH}
	install -m 0644 ${S}/CP932.txt                ${D}${PTEST_PATH}
	install -m 0644 ${S}/CP936.txt                ${D}${PTEST_PATH}
	install -m 0644 ${S}/L1.txt                   ${D}${PTEST_PATH}
}

ALLOW_EMPTY:${PN} = "1"

## subpackages
# -src : Source files
INSANE_SKIP:${PN}-src = "dev-deps"
RDEPENDS:${PN}-src = "\
	binutils \
	gcc-symlinks \
"

# -ptest : ptest wrappers
RDEPENDS:${PN}-ptest += " \
	bash \
	locale-base-en-us.iso-8859-1 \
	locale-base-ja-jp.windows-31j \
	locale-base-zh-cn.cp936 \
	localedef \
	ni-locale-alias \
	ptest-utils-bash \
"

repository: ni/meta-nilrt

repo_name: ni/meta-nilrt

branch_name: refs/heads/nilrt/master/kirkstone

gha_language: Shell


text:
@inproceedings {type-your-key-here,
  author = "Márcio Cornélio and Paulo Borba",
  booktitle = "6th International Conference on Software Reuse (ICSR 2000)",
  title = "Structuring Mechanisms for an Object-Oriented Formal Specification Language",
  year = "2000",
  pages = "402-419"
}

repository: pauloborba/academic-kickstart

repo_name: pauloborba/academic-kickstart


text:
SRC_URI = ${SOURCEFORGE_MIRROR}/docbook/docbook-xsl-${PV}.tar.gz

SRC_URI[md5sum] = "ed766902e8381f6206d12f5c326fbd47"
SRC_URI[sha256sum] = "900173715b9730c53048a19b238d5f1114be90e33d70b9d5217dcad1caffb3ad"

repository: overo/overo-oe-natty

repo_name: overo/overo-oe-natty

branch_name: HEAD


text:
package main

import (
	"reflect"
	"strconv"
	"testing"
)

var variableMapMergeTests = []struct {
	object, argument, result VariableMap
}{
	{VariableMap{"a": "value1"}, VariableMap{"b": "value2"}, VariableMap{"a": "value1", "b": "value2"}},
	{VariableMap{"a": "value1"}, VariableMap{"a": "value2"}, VariableMap{"a": "value1"}},
	{VariableMap{"a": map[string]string{"a": "value1"}}, VariableMap{"a": map[string]string{"b": "value2"}}, VariableMap{"a": map[string]string{"a": "value1", "b": "value2"}}},
	{VariableMap{"a": "value1"}, VariableMap{"a": map[string]string{"b": "value2"}}, VariableMap{"a": "value1"}},
	{VariableMap{"a": map[string]string{"a": "value1"}}, VariableMap{"a": map[string]string{"a": "value2"}}, VariableMap{"a": map[string]string{"a": "value1"}}},
	{VariableMap{"a": map[string]interface{}{"a": map[string]string{"a": "value1"}}}, VariableMap{"a": map[string]string{"a": "value2"}}, VariableMap{"a": map[string]interface{}{"a": map[string]string{"a": "value1"}}}},
	{VariableMap{"a": map[string]interface{}{"a": map[string]string{"a": "value1"}}}, VariableMap{"a": map[string]interface{}{"a": map[string]string{"b": "value2"}}}, VariableMap{"a": map[string]interface{}{"a": map[string]string{"a": "value1", "b": "value2"}}}},
}

func TestVariableMapMerge(t *testing.T) {
	for i, tt := range variableMapMergeTests {
		t.Run(strconv.Itoa(i+1), func(t *testing.T) {
			result := tt.object.MergeFrom(tt.argument)
			if !reflect.DeepEqual(result, tt.result) {
				t.Errorf("unequal results - expected %v, got %v", tt.result, result)
			}
		})
	}
}

func TestOddballMapMergeKeys(t *testing.T) {
	defer func() {
		r := recover()
		if r != mergeBadKeysPanic {
			t.Errorf("failed with incorrect panic - expected %s got %s", mergeBadKeysPanic, r)
		}
	}()

	a := VariableMap{"a": map[string]string{"a": "a"}}
	b := VariableMap{"a": map[int]string{3: "maybe"}}
	a.MergeFrom(b)

	t.Errorf("did not panic")
}

func TestOddballMapMergeValues(t *testing.T) {
	defer func() {
		r := recover()
		if r != mergeBadValsPanic {
			t.Errorf("failed with incorrect panic - expected %s got %s", mergeBadValsPanic, r)
		}
	}()

	a := VariableMap{"a": map[string]string{"a": "a"}}
	b := VariableMap{"a": map[string]int{"b": 3}}
	a.MergeFrom(b)

	t.Errorf("did not panic")
}

repository: parallelblock/yate

repo_name: parallelblock/yate


text:
SUMMARY = "A very basic image with Sound features"
LICENSE = "MIT"

require base-image.bb

IMAGE_INSTALL += " \
    util-linux \
    coreutils \
	mpd \
	samba \
    libav \
"

repository: shagu/meta-teapot

repo_name: shagu/meta-teapot


text:
SECTION = "devel/chicken"
DESCRIPTION = "enhanced scheduler"
LICENSE = "BSD"
LIC_FILES_CHKSUM = "file://high-load-scheduler.meta;md5=20b289d53eb041ed10ada9b3ed6a1bb4"

SRC_URI = "http://code.call-cc.org/egg-tarballs/4/high-load-scheduler/high-load-scheduler-${PV}.tar.gz"

SRC_URI[md5sum] = "52b97de9cee103e3ccee36c25196b044"
SRC_URI[sha256sum] = "072a1ff69caf41f681e283901b1e4886557494e8094f38b7e7bbffaad38210e6"

S = "${WORKDIR}/high-load-scheduler-${PV}"

inherit chicken_install

BBCLASSEXTEND = "cross crosssdk nativesdk"

repository: OSSystems/meta-chicken

repo_name: OSSystems/meta-chicken


text:
DESCRIPTION = "Debian's start-stop-daemon utility"
SECTION = "base"
PRIORITY = "optional"
LICENSE = "PD"
PR = "r1"

SRC_URI = "file://start-stop-daemon.c"

S = "${WORKDIR}"

do_configure() {
	:
}

do_compile() {
	${CC} ${CFLAGS} ${LDFLAGS} ${WORKDIR}/start-stop-daemon.c -o start-stop-daemon
}

do_install () {
	install -d ${D}/${base_sbindir}
	install -m 0755 ${S}/start-stop-daemon ${D}/${base_sbindir}/start-stop-daemon.${PN}
}

pkg_postinst_${PN} () {
	update-alternatives --install ${base_sbindir}/start-stop-daemon start-stop-daemon start-stop-daemon.${PN} 100
}

pkg_prerm_${PN} () {
	update-alternatives --remove start-stop-daemon start-stop-daemon.${PN}
}


text:
// Copyright 2013 Ardan Studios. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE handle.

// Package serviceTests implements tests for all system services.
package serviceTests

import (
	"time"
	"testing"

  . "github.com/goinggo/beego-mgo/utilities/scheduler"
	. "github.com/smartystreets/goconvey/convey"

	"gopkg.in/mgo.v2/bson"
)

// Test_CreateSchedule checks that a new schedule can be created via the scheduler
/*func Test_CreateSchedule(t *testing.T) {

	scheduler.CreateSchedule()

	Convey("Subject: Test CreateSchedule", t, func() {
		Convey("Should Be Able To Start the scheduler", func() {
			So(nil, ShouldEqual, nil)
		})
	})
}*/

func Test_IMRequests(t *testing.T) {
	myFormat := "Jan _2 2006 15:04:05"
	t1, _ := time.Parse(myFormat, "Dec 12 2016 06:00:00")
	app1 := Appointment{t1,1} // 6-7 appointment on Dec 12
	t2, _ := time.Parse(myFormat, "Dec 12 2016 08:00:00")
	app2 := Appointment{t2,2} // 8-10 appointment on Dec 12
	t3, _ := time.Parse(myFormat, "Dec 12 2016 09:00:00")
	app3 := Appointment{t3,2} // 9-11 appointment on Dec 12

	req1 := IMRequest{bson.NewObjectId(), nil, "pending", "", app1}
	req2 := IMRequest{bson.NewObjectId(), nil, "pending", "", app2}
	req3 := IMRequest{bson.NewObjectId(), nil, "pending", "", app3}
	req4 := IMRequest{bson.NewObjectId(), nil, "allocated", "cg1@test.com", app1}

	aSolution := []IMRequest{req1,req2,req4}

	SS := &SchedulingSolution{aSolution}
	BB := &SchedulingSolution{}

	m := make(map[string]IMBookings)
	m["cg1@test.com"] = IMBookings{make([]Appointment, 0)}
	m["cg2@test.com"] = IMBookings{make([]Appointment, 0)}
	cSolution := []IMRequest{req1,req2,req3}
	TT := &SchedulingSolution{cSolution}

	aBoard := &SolutionBoard{m, TT, SS, false}

	Convey("Subject: Test In-Memory Requests", t, func() {
		Convey("Score function should return 33 when only one of three requests are allocated", func() {
			So(SS.Score(), ShouldEqual, 33)
		})
		Convey("Should Have data after copying and should report the exact same score", func() {
			BB.Copy(SS)
			So(BB.Size(), ShouldBeGreaterThan, 0)
			So(BB.Score(), ShouldEqual, 33)
		})
	})
	Convey("Subject: Test Solution Board", t, func() {
		Convey("Assign should improve current solution score", func() {
			aBoard.Assign("cg1@test.com",req1,0)
			So(aBoard.CurrentSolution.Score(), ShouldBeGreaterThan, 0)
		})
		Convey("Unassign should return the score back to what it was", func() {
			aBoard.Unassign("cg1@test.com",req1,0)
			So(aBoard.CurrentSolution.Score(), ShouldEqual, 0)
		})
		Convey("CanPlay should be false if a conflicting request comes in", func() {
			aBoard.Assign("cg1@test.com",req2,0)
			aBoard.CanPlay("cg1@test.com",req3)
			So(aBoard.CanPlay("cg1@test.com",req3), ShouldBeFalse)
		})
		Convey("CanPlay should be ok if a non-conflicting request comes in", func() {
			aBoard.CanPlay("cg1@test.com",req3)
			So(aBoard.CanPlay("cg2@test.com",req3), ShouldBeTrue)
		})
	})
}

func Test_Appointments(t *testing.T) {
	myFormat := "Jan _2 2006 15:04:05"
	t2, _ := time.Parse(myFormat, "Dec 12 2016 06:00:00")
	app1 := Appointment{t2,1}
	app2 := Appointment{t2,1}
	app3 := Appointment{t2,3} //Defines time interval 6-9

	t3, _ := time.Parse(myFormat, "Dec 12 2016 08:00:00")
	app4 := Appointment{t3,2} //Defines time interval 8-10

	t4, _ := time.Parse(myFormat, "Dec 12 2016 09:00:00")
	app5 := Appointment{t4,2} //Defines time interval 9-11

	t5, _ := time.Parse(myFormat, "Dec 13 2016 09:00:00")
	app6 := Appointment{t5,2} //Defines time interval 9-11

	Convey("Subject: Test Appointments", t, func() {
		Convey("Should Be Equal if they define the exact same time interval", func() {
			So(app1.Equals(app2), ShouldBeTrue)
		})
		Convey("Should Not Be Equal if they don't define the exact same time interval", func() {
			So(app1.Equals(app3), ShouldBeFalse)
		})
		Convey("Should Not Be Equal if they don't occur on the same day", func() {
			So(app5.Equals(app6), ShouldBeFalse)
		})
		Convey("Should Not Conflict if their time intervals do not intersect", func() {
			So(app3.ConflictsWith(app5), ShouldBeFalse)
		})
		Convey("Should Conflict if their time intervals do intersect", func() {
			So(app3.ConflictsWith(app4), ShouldBeTrue)
		})
	})
}


text:
package wok

import (
	"github.com/andviro/noodle"
	mw "github.com/andviro/noodle/middleware"
	"golang.org/x/net/context"
	"net/http"
	"strings"
)

type HandlerC interface {
	ServeHTTPC(context.Context, http.ResponseWriter, *http.Request)
}

// HandleC adapts handlers that implement ServeHTTPC method into Wok
func (f RouteClosure) HandleC(h HandlerC) {
	f(func(ctx context.Context, w http.ResponseWriter, r *http.Request) error {
		h.ServeHTTPC(ctx, w, r)
		return nil
	})
}

// HandleFuncC adapts functions compatible with ServeHTTPC signature into Wok
func (f RouteClosure) HandleFuncC(h func(ctx context.Context, w http.ResponseWriter, r *http.Request)) {
	f(func(ctx context.Context, w http.ResponseWriter, r *http.Request) error {
		h(ctx, w, r)
		return nil
	})
}

func UrlJoin(paths ...string) (res string) {
	rawRes := strings.Join(paths, "/")
	for _, s := range strings.Split(rawRes, "/") {
		if s != "" {
			res += "/" + s
		}
	}
	if res == "" {
		return "/"
	}
	return
}

// Default creates new Wok with the default Noodle middleware chain
func Default(mws ...noodle.Middleware) *Wok {
	return New(mw.Default(mws...)...)
}

// GET is a convenience wrapper over Wok.Handle
func (wok *Wok) GET(path string, mws ...noodle.Middleware) RouteClosure {
	return wok.Handle("GET", path, mws...)
}

// POST is a convenience wrapper over Wok.Handle
func (wok *Wok) POST(path string, mws ...noodle.Middleware) RouteClosure {
	return wok.Handle("POST", path, mws...)
}

// DELETE is a convenience wrapper over Wok.Handle
func (wok *Wok) DELETE(path string, mws ...noodle.Middleware) RouteClosure {
	return wok.Handle("DELETE", path, mws...)
}

// PATCH is a convenience wrapper over Wok.Handle
func (wok *Wok) PATCH(path string, mws ...noodle.Middleware) RouteClosure {
	return wok.Handle("PATCH", path, mws...)
}

// PUT is a convenience wrapper over Wok.Handle
func (wok *Wok) PUT(path string, mws ...noodle.Middleware) RouteClosure {
	return wok.Handle("PUT", path, mws...)
}

// OPTIONS is a convenience wrapper over Wok.Handle
func (wok *Wok) OPTIONS(path string, mws ...noodle.Middleware) RouteClosure {
	return wok.Handle("OPTIONS", path, mws...)
}

repository: andviro/noodle

repo_name: andviro/noodle


text:
file(REMOVE_RECURSE
  "CMakeFiles/quickstep_types_TypeID.dir/TypeID.cpp.o"
  "libquickstep_types_TypeID.pdb"
  "libquickstep_types_TypeID.a"
)

# Per-language clean rules from dependency scanning.
foreach(lang CXX)
  include(CMakeFiles/quickstep_types_TypeID.dir/cmake_clean_${lang}.cmake OPTIONAL)
endforeach()

repository: kpgaffney/quickstep-optimizer-rs

repo_name: kpgaffney/quickstep-optimizer-rs


text:
DESCRIPTION = "Simple integration of Flask and WTForms"
HOMEPAGE = "https://pypi.python.org/pypi/Flask-WTF/"
SECTION = "devel/python"
LICENSE = "BSD-3-Clause"
LIC_FILES_CHKSUM = "file://LICENSE;md5=d1eb373eabc6d20a5c4f2a2214f42b71"

PR = "r0"
SRCNAME = "Flask-WTF"

SRC_URI = "https://pypi.python.org/packages/source/F/${SRCNAME}/${SRCNAME}-${PV}.tar.gz"

SRC_URI[md5sum] = "2932ac0e7e8df26f6efb6ee7e6cfb783"
SRC_URI[sha256sum] = "2926a265e6aa163a2102a8f058ad89acb9304665c476cea9687243bcc8f99b45"

ENDS_${PN} += "python-core python-flask"

S = "${WORKDIR}/${SRCNAME}-${PV}"

inherit setuptools

repository: johnnykv/meta-crow

repo_name: johnnykv/meta-crow


text:
@online{price_can_nodate,
	title = {Can Patients Get Research They Deserve?},
	url = {http://www.ithinkwell.org/can-patients-get-research-they-deserve/},
	abstract = {Excerpt: "Good decisions in patient research require listening with a mind to hear. Problem solve without blaming, Give research a chance! Let this video about research application  get you thinking about the problem with strictly following  guidelines and shooting for targets and {NOT} using evidence to help you and your patient make decisions. The lab coat logos are from top drug companies, top Rx medications and top guideline producers. Guidelines are useful but without evidence and common sense mixed with the values of the patients they are not enough. Patient, doctor or researcher when you make choices  make sure you know what the evidence is, what is the quality of this evidence and what the choices are. Good decisions for patient research require listening with a mind to hear."},
	titleaddon = {Jetpack by {WordPress}.com},
	author = {Price, Amy},
	urldate = {2013-03-13}
}

repository: pmean/build-website

repo_name: pmean/build-website


text:
package typecaster

import (
	"testing"
	"github.com/stretchr/testify/assert"
)

type transaction struct {
	Type string `refmt:"type"`
	Payload interface{}
}

func init() {
	AddType(transaction{})
}

func TestToType(t *testing.T) {
	trans := &transaction{
		Type: "ADD_DATA",
		Payload: map[string]interface{}	{
			"path": "child/is/good",
			"value": "good",
		},
	}

	jsonish := map[string]interface{} {
		"type": "ADD_DATA",
		"payload": map[string]string {
			"path": "child/is/good",
			"value": "good",
		},
	}

	newTrans := &transaction{}

	err := ToType(jsonish, newTrans)

	assert.Nil(t, err)

	assert.Equal(t, trans, newTrans)
}

repository: quorumcontrol/chaintree

repo_name: quorumcontrol/chaintree

gha_language: Go


text:
// Copyright 2015-2023 Bleemeo
//
// bleemeo.com an infrastructure monitoring solution in the Cloud
//
// 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 synchronizer

import (
	"context"
	"encoding/json"
	"fmt"
	"glouton/bleemeo/client"
	bleemeoTypes "glouton/bleemeo/types"
	"glouton/logger"
	"glouton/prometheus/rules"
	"glouton/threshold"
	"glouton/types"
	"math"
	"time"

	"github.com/prometheus/prometheus/model/labels"
	"github.com/prometheus/prometheus/promql/parser"
)

type minimalThreshold struct {
	high       float64
	low        float64
	metricName string
}

func (s *Synchronizer) syncAlertingRules(ctx context.Context, fullSync bool, onlyEssential bool) (updateThresholds bool, err error) {
	_ = onlyEssential

	if s.option.RebuildPromQLRules == nil {
		return false, nil
	}

	previousAlertingRules := s.option.Cache.AlertingRules()
	pendingUpdates := s.popPendingAlertingRulesUpdate()

	if len(pendingUpdates) > len(previousAlertingRules)*3/100 {
		// If more than 3% of known alerting rules needs update, do a full
		// update. 3% is arbitrarily chosen, based on assumption request for
		// one page is cheaper than 3 request for one metric.
		fullSync = true
	}

	if fullSync {
		alertingRules, err := s.fetchAllAlertingRules(ctx)
		if err != nil {
			return false, fmt.Errorf("failed to fetch alerting rules: %w", err)
		}

		s.option.Cache.SetAlertingRules(alertingRules)
	} else {
		// Use a map to remove the previous alerting rules that are updated.
		alertingRulesByID := make(map[string]bleemeoTypes.AlertingRule)
		for _, previousRule := range previousAlertingRules {
			alertingRulesByID[previousRule.ID] = previousRule
		}

		for _, alertingRuleID := range pendingUpdates {
			alertingRule, err := s.fetchAlertingRule(ctx, alertingRuleID)
			if err != nil {
				// Delete the alerting rule if it's no longer present on the API.
				if client.IsNotFound(err) {
					delete(alertingRulesByID, alertingRuleID)

					continue
				}

				// Add the alerting rule to the pending update list to retry it later.
				s.UpdateAlertingRule(alertingRuleID)
				logger.V(1).Printf("Failed to fetch alerting rule %s", alertingRuleID)

				continue
			}

			alertingRulesByID[alertingRule.ID] = alertingRule
		}

		alertingRules := make([]bleemeoTypes.AlertingRule, 0, len(alertingRulesByID))
		for _, rule := range alertingRulesByID {
			alertingRules = append(alertingRules, rule)
		}

		s.option.Cache.SetAlertingRules(alertingRules)
	}

	err = s.UpdateAlertingRules()

	return true, err
}

// fetchAlertingRule fetches a single alerting rule from the API.
func (s *Synchronizer) fetchAlertingRule(ctx context.Context, id string) (alertingRule bleemeoTypes.AlertingRule, err error) {
	_, err = s.client.Do(ctx, "GET", fmt.Sprintf("v1/alertingrule/%s/", id), nil, nil, &alertingRule)
	if err != nil {
		return bleemeoTypes.AlertingRule{}, fmt.Errorf("client do: %w", err)
	}

	return alertingRule, nil
}

// fetchAllAlertingRules fetches all the alerting rules from the API.
func (s *Synchronizer) fetchAllAlertingRules(ctx context.Context) (alertingRules []bleemeoTypes.AlertingRule, err error) {
	params := map[string]string{
		"active": "true",
	}

	result, err := s.client.Iter(ctx, "alertingrule", params)
	if err != nil {
		return nil, fmt.Errorf("client iter: %w", err)
	}

	alertingRules = make([]bleemeoTypes.AlertingRule, 0, len(result))

	for _, jsonMessage := range result {
		var alertingRule bleemeoTypes.AlertingRule

		if err := json.Unmarshal(jsonMessage, &alertingRule); err != nil {
			logger.V(2).Printf("Failed to unmarshal alerting rule: %v", err)

			continue
		}

		alertingRules = append(alertingRules, alertingRule)
	}

	return alertingRules, nil
}

// UpdateAlertingRules updates the alerting rules from the cache.
func (s *Synchronizer) UpdateAlertingRules() error {
	agents := s.option.Cache.AgentsByUUID()
	configs := s.option.Cache.AccountConfigsByUUID()
	needConfigUpdate := false

	// Reset the threshold overrides.
	s.l.Lock()
	s.thresholdOverrides = make(map[thresholdOverrideKey]threshold.Threshold)
	s.l.Unlock()

	var promqlRules []rules.PromQLRule

	alertingRules := s.option.Cache.AlertingRules()
	for _, rule := range alertingRules {
		// Convert the alerting rule to a threshold override when the queries are simple.
		if s.alertingRuleToThresholdOverride(rule) {
			logger.V(1).Printf("The alerting rule %s has been converted to a threshold override", rule.ID)

			continue
		}

		newPromQLRules, needConfigUpdateTmp := s.alertingRuleToPromQLRules(rule, agents, configs)
		promqlRules = append(promqlRules, newPromQLRules...)
		needConfigUpdate = needConfigUpdate || needConfigUpdateTmp
	}

	if needConfigUpdate {
		s.l.Lock()
		s.forceSync[syncMethodAccountConfig] = true
		s.l.Unlock()
	}

	if err := s.option.RebuildPromQLRules(promqlRules); err != nil {
		return fmt.Errorf("failed to rebuild PromQL rules: %w", err)
	}

	return nil
}

// alertingRuleToPromQLRule converts an AlertingRule to PromQLRules (one for each known agent).
func (s *Synchronizer) alertingRuleToPromQLRules(
	alertingRule bleemeoTypes.AlertingRule,
	agents map[string]bleemeoTypes.Agent,
	configs map[string]bleemeoTypes.GloutonAccountConfig,
) (promqlRules []rules.PromQLRule, needConfigUpdate bool) {
	agentIDs := s.filterAgents(alertingRule.Agents, agents)
	promqlRules = make([]rules.PromQLRule, 0, len(agentIDs))

	for _, agentID := range agentIDs {
		// Find the resolution of this agent from the config.
		agent := agents[agentID]

		cfg, ok := configs[agent.CurrentConfigID]
		if !ok {
			logger.V(1).Printf("Config for agent %s not found", agent.CurrentConfigID)

			needConfigUpdate = true

			continue
		}

		agentConfig, ok := cfg.AgentConfigByID[agent.AgentType]
		if !ok {
			logger.V(1).Printf("Agent config for agent %s and type %s not found", agent.CurrentConfigID, agent.AgentType)

			needConfigUpdate = true

			continue
		}

		if agentConfig.MetricResolution == 0 {
			logger.V(1).Printf(
				"Empty metric resolution for agent config of agent %s and type %s",
				agent.CurrentConfigID,
				agent.AgentType,
			)

			continue
		}

		promqlRule := rules.PromQLRule{
			Name:           alertingRule.Name,
			AlertingRuleID: alertingRule.ID,
			InstanceID:     agentID,
			WarningQuery:   alertingRule.WarningQuery,
			WarningDelay:   time.Duration(alertingRule.WarningDelaySecond) * time.Second,
			CriticalQuery:  alertingRule.CriticalQuery,
			CriticalDelay:  time.Duration(alertingRule.CriticalDelaySecond) * time.Second,
			Resolution:     agentConfig.MetricResolution,
		}

		promqlRules = append(promqlRules, promqlRule)
	}

	return promqlRules, needConfigUpdate
}

// filterAgents removes the agents this Glouton doesn't manage.
func (s *Synchronizer) filterAgents(agents []string, knownAgentsByUUID map[string]bleemeoTypes.Agent) []string {
	var filteredAgents []string

	for _, agent := range agents {
		if _, ok := knownAgentsByUUID[agent]; ok {
			filteredAgents = append(filteredAgents, agent)
		}
	}

	return filteredAgents
}

// UpdateAlertingRule requests an update for the given alerting rule UUID.
func (s *Synchronizer) UpdateAlertingRule(alertingRuleID string) {
	s.l.Lock()
	defer s.l.Unlock()

	s.pendingAlertingRulesUpdate = append(s.pendingAlertingRulesUpdate, alertingRuleID)
	s.forceSync[syncMethodAlertingRules] = false
}

func (s *Synchronizer) popPendingAlertingRulesUpdate() []string {
	s.l.Lock()
	defer s.l.Unlock()

	set := make(map[string]bool, len(s.pendingAlertingRulesUpdate))

	for _, id := range s.pendingAlertingRulesUpdate {
		set[id] = true
	}

	s.pendingAlertingRulesUpdate = nil
	result := make([]string, 0, len(set))

	for id := range set {
		result = append(result, id)
	}

	return result
}

// alertingRuleToThresholdOverride tries to convert an alerting rule to a threshold override.
// The thresholds should be updated with UpdateUnitsAndThresholds() after this function is called.
func (s *Synchronizer) alertingRuleToThresholdOverride(rule bleemeoTypes.AlertingRule) (success bool) {
	warningThreshold, ok := queryToThreshold(rule.WarningQuery)
	if !ok {
		return false
	}

	criticalThreshold, ok := queryToThreshold(rule.CriticalQuery)
	if !ok {
		return false
	}

	if rule.WarningQuery != "" && rule.CriticalQuery != "" &&
		warningThreshold.metricName != criticalThreshold.metricName {
		return false
	}

	// Create a threshold override for each agent this rule applies to.
	s.l.Lock()
	defer s.l.Unlock()

	for _, agentID := range rule.Agents {
		var key thresholdOverrideKey

		if warningThreshold.metricName != "" {
			key = thresholdOverrideKey{
				MetricName: warningThreshold.metricName,
				AgentID:    agentID,
			}
		} else {
			key = thresholdOverrideKey{
				MetricName: criticalThreshold.metricName,
				AgentID:    agentID,
			}
		}

		newThreshold := threshold.Threshold{
			LowWarning:    warningThreshold.low,
			HighWarning:   warningThreshold.high,
			WarningDelay:  time.Duration(rule.WarningDelaySecond) * time.Second,
			LowCritical:   criticalThreshold.low,
			HighCritical:  criticalThreshold.high,
			CriticalDelay: time.Duration(rule.CriticalDelaySecond) * time.Second,
		}

		// If multiple threshold apply on the same metric and agent, we merge them.
		if oldThreshold, ok := s.thresholdOverrides[key]; ok {
			s.thresholdOverrides[key] = oldThreshold.Merge(newThreshold)
		} else {
			s.thresholdOverrides[key] = newThreshold
		}
	}

	return true
}

// queryToThreshold tries to convert a simple PromQL query to a threshold.
// For instance, "cpu_used > 80" -> metric = cpu_used, high threshold = 80.
func queryToThreshold(query string) (threshold minimalThreshold, success bool) {
	threshold = minimalThreshold{
		low:  math.NaN(),
		high: math.NaN(),
	}

	if query == "" {
		return threshold, true
	}

	expr, err := parser.ParseExpr(query)
	if err != nil {
		return threshold, false
	}

	binaryExpr, ok := expr.(*parser.BinaryExpr)
	if !ok {
		return threshold, false
	}

	// Check if the query is like "cpu_used > 80".
	vectorFirst := true
	vectorExpr, ok1 := binaryExpr.LHS.(*parser.VectorSelector)
	numberExpr, ok2 := binaryExpr.RHS.(*parser.NumberLiteral)

	// Else try "80 < cpu_used".
	if !(ok1 && ok2) {
		vectorFirst = false
		numberExpr, ok1 = binaryExpr.LHS.(*parser.NumberLiteral)
		vectorExpr, ok2 = binaryExpr.RHS.(*parser.VectorSelector)
	}

	if !(ok1 && ok2) {
		return threshold, false
	}

	// A simple query must not contain any other matcher than the metric name.
	if len(vectorExpr.LabelMatchers) != 1 {
		return threshold, false
	}

	matcher := vectorExpr.LabelMatchers[0]
	if !(matcher.Type == labels.MatchEqual && matcher.Name == types.LabelName) {
		return threshold, false
	}

	threshold.metricName = matcher.Value

	switch op := binaryExpr.Op; {
	case vectorFirst && op == parser.GTR || !vectorFirst && op == parser.LSS:
		threshold.high = numberExpr.Val
	case vectorFirst && op == parser.GTE || !vectorFirst && op == parser.LTE:
		// The threshold current implementation only supports strict inequalities,
		// so we convert a non strict inequality to a strict one.
		// The idea is to change the value by the smallest possible amount:
		// "cpu_used >= 80" becomes "cpu_used > 79.99999999999999".
		threshold.high = math.Nextafter(numberExpr.Val, numberExpr.Val-1)
	case vectorFirst && op == parser.LSS || !vectorFirst && op == parser.GTR:
		threshold.low = numberExpr.Val
	case vectorFirst && op == parser.LTE || !vectorFirst && op == parser.GTE:
		threshold.low = math.Nextafter(numberExpr.Val, numberExpr.Val+1)
	default:
		return threshold, false
	}

	return threshold, true
}

repository: bleemeo/glouton

repo_name: bleemeo/glouton


text:
package main

import (
	"./gobatsd"
	"bufio"
	"fmt"
	"net"
	"os"
	"path/filepath"
	"runtime"
	"strconv"
	"strings"
	"syscall"
	"time"

	"github.com/noahhl/Go-Redis"
	"github.com/reusee/mmh3"
)

type Datapoint struct {
	Timestamp time.Time
	Name      string
	Value     float64
	Datatype  string
}

type AggregateObservation struct {
	Name      string
	Content   string
	Timestamp int64
	RawName   string
}

var gaugeChannel chan Datapoint
var counterChannel chan Datapoint
var timerChannel chan Datapoint
var diskAppendChannel chan AggregateObservation
var redisAppendChannel chan AggregateObservation
var timerHeartbeat chan int
var counterHeartbeat chan int

const readLen = 65536
const channelBufferSize = 10000
const heartbeatInterval = 1
const numIncomingMessageProcessors = 100

func main() {
	gobatsd.LoadConfig()
	gaugeChannel = make(chan Datapoint, channelBufferSize)
	counterChannel = make(chan Datapoint, channelBufferSize)
	timerChannel = make(chan Datapoint, channelBufferSize)
	counterHeartbeat = make(chan int)
	timerHeartbeat = make(chan int)

	fmt.Printf("Starting on port %v\n", gobatsd.Config.Port)
	runtime.GOMAXPROCS(runtime.NumCPU())

	datapointChannel := saveNewDatapoints()
	diskAppendChannel = appendToFile(datapointChannel)
	redisAppendChannel = addToRedisZset()

	processingChannel := make(chan string, channelBufferSize)
	for i := 0; i < numIncomingMessageProcessors; i++ {
		launchMessageProcessor(processingChannel)
	}

	go runHeartbeat()

	go processGauges(gaugeChannel)
	go processCounters(counterChannel)
	go processTimers(timerChannel)

	go bindUDP(processingChannel)
	go bindTCP(processingChannel)

	c := make(chan int)
	for {
		<-c
	}

}

func runHeartbeat() {
	ticker := time.NewTicker(1 * time.Second)
	for {
		select {
		case <-ticker.C:
			counterHeartbeat <- 1
			timerHeartbeat <- 1
		}
	}
}

func bindUDP(processingChannel chan string) {

	server, err := net.ListenPacket("udp", ":"+gobatsd.Config.Port)
	defer server.Close()
	if err != nil {
		panic(err)
	}

	buffer := make([]byte, readLen)
	for {
		n, _, err := server.ReadFrom(buffer)
		if err != nil {
			continue
		}
		payload := string(buffer[0:n])
		messages := strings.Split(payload, "\n")
		for i := range messages {
			if messages[i] != "" {
				select {
				case processingChannel <- strings.TrimSpace(strings.Replace(messages[i], "\n", "", -1)):
				default:
				}
			}

		}
	}
}

func bindTCP(processingChannel chan string) {

	server, err := net.Listen("tcp", ":"+gobatsd.Config.Port)
	if err != nil {
		panic(err)
	}
	conns := clientTCPConns(server)
	for {
		go func(client net.Conn) {
			b := bufio.NewReader(client)
			for {
				line, err := b.ReadBytes('\n')
				if err != nil {
					return
				}
				select {
				case processingChannel <- strings.TrimSpace(strings.Replace(string(line), "\n", "", -1)):
				default:
				}
			}
		}(<-conns)
	}
}

func clientTCPConns(listener net.Listener) chan net.Conn {
	ch := make(chan net.Conn)
	go func() {
		for {
			client, err := listener.Accept()
			if client == nil {
				fmt.Printf("couldn't accept: %v", err)
				continue
			}
			ch <- client
		}
	}()
	return ch
}

func launchMessageProcessor(ch chan string) {
	go func(channel chan string) {
		for {
			message := <-channel
			processIncomingMessage(message)
		}
	}(ch)
}

func processIncomingMessage(message string) {
	d := parseDatapoint(message)
	if d.Datatype == "g" {
		gaugeChannel <- d
	} else if d.Datatype == "c" {
		counterChannel <- d
	} else if d.Datatype == "ms" {
		timerChannel <- d
	}
}

func parseDatapoint(metric string) Datapoint {
	d := Datapoint{}
	components := strings.Split(metric, ":")
	if len(components) == 2 {
		latter_components := strings.Split(components[1], "|")
		if len(latter_components) >= 2 {
			value, _ := strconv.ParseFloat(latter_components[0], 64)
			if len(latter_components) == 3 && latter_components[1] == "c" {
				sample_rate, _ := strconv.ParseFloat(strings.Replace(latter_components[2], "@", "", -1), 64)
				value = value / sample_rate
			}
			d = Datapoint{time.Now(), components[0], value, latter_components[1]}
		}
	}
	return d
}

func saveNewDatapoints() chan string {
	c := make(chan string, channelBufferSize)

	go func(ch chan string) {
		spec := redis.DefaultSpec().Host(gobatsd.Config.RedisHost).Port(gobatsd.Config.RedisPort)
		redis, _ := redis.NewSynchClientWithSpec(spec)
		for {
			d := <-ch
			redis.Sadd("datapoints", []byte(d))
		}
	}(c)

	return c
}

func appendToFile(datapoints chan string) chan AggregateObservation {
	c := make(chan AggregateObservation, channelBufferSize)

	go func(ch chan AggregateObservation, datapoints chan string) {
		for {
			observation := <-ch
			filename := gobatsd.CalculateFilename(observation.Name, gobatsd.Config.Root)

			file, err := os.OpenFile(filename, os.O_APPEND|os.O_WRONLY, 0600)
			newFile := false
			if err != nil {
				if e, ok := err.(*os.PathError); ok && e.Err == syscall.ENOENT {
					fmt.Printf("Creating %v\n", filename)
					//Make containing directories if they don't exist
					err = os.MkdirAll(filepath.Dir(filename), 0755)
					if err != nil {
						fmt.Printf("%v", err)
					}

					file, err = os.Create(filename)
					if err != nil {
						fmt.Printf("%v", err)
					}
					newFile = true
					datapoints <- observation.RawName
				} else {
					panic(err)
				}
			}
			if file != nil {
				writer := bufio.NewWriter(file)
				if newFile {
					writer.WriteString("v2 " + observation.Name + "\n")
				}
				writer.WriteString(observation.Content)
				writer.Flush()
				file.Close()
			}
		}
	}(c, datapoints)
	return c
}

func addToRedisZset() chan AggregateObservation {
	c := make(chan AggregateObservation, channelBufferSize)
	go func(ch chan AggregateObservation) {
		spec := redis.DefaultSpec().Host(gobatsd.Config.RedisHost).Port(gobatsd.Config.RedisPort)
		redis, _ := redis.NewSynchClientWithSpec(spec)
		for {
			observation := <-ch
			redis.Zadd(observation.Name, float64(observation.Timestamp), []byte(observation.Content))
		}
	}(c)

	return c

}

func processGauges(gauges chan Datapoint) {
	for {
		d := <-gauges
		//fmt.Printf("Processing gauge %v with value %v and timestamp %v \n", d.Name, d.Value, d.Timestamp)
		observation := AggregateObservation{"gauges:" + d.Name, fmt.Sprintf("%d %v\n", d.Timestamp.Unix(), d.Value), 0, "gauges:" + d.Name}
		diskAppendChannel <- observation
	}
}

type Counter struct {
	Key   string
	Value float64
}

func processCounters(ch chan Datapoint) {
	currentSlots := make([]int64, len(gobatsd.Config.Retentions))
	maxSlots := make([]int64, len(gobatsd.Config.Retentions))
	for i := range gobatsd.Config.Retentions {
		currentSlots[i] = 0
		maxSlots[i] = gobatsd.Config.Retentions[i].Interval / heartbeatInterval
	}

	counters := make([][]map[string]float64, len(gobatsd.Config.Retentions))
	for i := range counters {
		counters[i] = make([]map[string]float64, maxSlots[i])
		for j := range counters[i] {
			counters[i][j] = make(map[string]float64)
		}
	}

	for {
		select {
		case d := <-ch:
			//fmt.Printf("Processing counter %v with value %v and timestamp %v \n", d.Name, d.Value, d.Timestamp)
			for i := range gobatsd.Config.Retentions {
				hashSlot := int64(mmh3.Hash32([]byte(d.Name))) % maxSlots[i]
				counters[i][hashSlot][d.Name] += d.Value
			}

		case <-counterHeartbeat:
			for i := range currentSlots {
				timestamp := time.Now().Unix() - (time.Now().Unix() % gobatsd.Config.Retentions[i].Interval)
				for key, value := range counters[i][currentSlots[i]] {
					if value > 0 {
						if i == 0 { //Store to redis
							observation := AggregateObservation{"counters:" + key, fmt.Sprintf("%d<X>%v", timestamp, value), timestamp, "counters:" + key}
							redisAppendChannel <- observation
						} else {
							observation := AggregateObservation{"counters:" + key + ":" + strconv.FormatInt(gobatsd.Config.Retentions[i].Interval, 10), fmt.Sprintf("%d %v\n", timestamp, value), timestamp, "counters:" + key}
							diskAppendChannel <- observation
						}
						delete(counters[i][currentSlots[i]], key)
					}
				}

				currentSlots[i] += 1
				if currentSlots[i] == maxSlots[i] {
					currentSlots[i] = 0
				}
			}
		}
	}
}

func processTimers(ch chan Datapoint) {

	currentSlots := make([]int64, len(gobatsd.Config.Retentions))
	maxSlots := make([]int64, len(gobatsd.Config.Retentions))
	for i := range gobatsd.Config.Retentions {
		currentSlots[i] = 0
		maxSlots[i] = gobatsd.Config.Retentions[i].Interval / heartbeatInterval
	}

	timers := make([][]map[string][]float64, len(gobatsd.Config.Retentions))
	for i := range timers {
		timers[i] = make([]map[string][]float64, maxSlots[i])
		for j := range timers[i] {
			timers[i][j] = make(map[string][]float64)
		}
	}

	for {
		select {
		case d := <-ch:
			//fmt.Printf("Processing timer %v with value %v and timestamp %v \n", d.Name, d.Value, d.Timestamp)
			for i := range gobatsd.Config.Retentions {
				hashSlot := int64(mmh3.Hash32([]byte(d.Name))) % maxSlots[i]
				timers[i][hashSlot][d.Name] = append(timers[i][hashSlot][d.Name], d.Value)
			}
		case <-timerHeartbeat:
			for i := range currentSlots {
				//fmt.Printf("%v %v %v\n", i, currentSlots[i], timers[i][currentSlots[i]])

				timestamp := time.Now().Unix() - (time.Now().Unix() % gobatsd.Config.Retentions[i].Interval)

				for key, value := range timers[i][currentSlots[i]] {
					if len(value) > 0 {
						count := len(value)
						min := gobatsd.Min(value)
						max := gobatsd.Max(value)
						median := gobatsd.Median(value)
						mean := gobatsd.Mean(value)
						stddev := gobatsd.Stddev(value)
						percentile_90 := gobatsd.Percentile(value, 0.9)
						percentile_95 := gobatsd.Percentile(value, 0.95)
						percentile_99 := gobatsd.Percentile(value, 0.99)

						aggregates := fmt.Sprintf("%v/%v/%v/%v/%v/%v/%v/%v/%v", count, min, max, median, mean, stddev, percentile_90, percentile_95, percentile_99)
						if i == 0 { //Store to redis
							observation := AggregateObservation{"timers:" + key, fmt.Sprintf("%d<X>%v", timestamp, aggregates), timestamp, "timers:" + key}
							redisAppendChannel <- observation
						} else { // Store to disk
							observation := AggregateObservation{"timers:" + key + ":" + strconv.FormatInt(gobatsd.Config.Retentions[i].Interval, 10) + ":2", fmt.Sprintf("%d %v\n", timestamp, aggregates), timestamp, "timers:" + key}
							diskAppendChannel <- observation
						}

						delete(timers[i][currentSlots[i]], key)
					}
				}

				currentSlots[i] += 1
				if currentSlots[i] == maxSlots[i] {
					currentSlots[i] = 0
				}
			}

		}
	}
}

repository: jalons/go-batsd

repo_name: jalons/go-batsd


text:
//
// Copyright (c) 2015 The heketi 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 commands

import (
	"encoding/json"
	"errors"
	"flag"
	"fmt"
	"github.com/heketi/heketi/apps/glusterfs"
	client "github.com/heketi/heketi/client/api/go-client"
	"github.com/lpabon/godbc"
)

type NodeAddCommand struct {
	Cmd
	zone               int
	managmentHostNames string
	storageHostNames   string
	clusterId          string
}

func NewNodeAddCommand(options *Options) *NodeAddCommand {

	godbc.Require(options != nil)

	cmd := &NodeAddCommand{}
	cmd.name = "add"
	cmd.options = options
	cmd.flags = flag.NewFlagSet(cmd.name, flag.ExitOnError)
	cmd.flags.IntVar(&cmd.zone, "zone", -1, "The zone in which the node should reside")
	cmd.flags.StringVar(&cmd.clusterId, "cluster", "", "The cluster in which the node should reside")
	cmd.flags.StringVar(&cmd.managmentHostNames, "management-host-name", "", "Managment host name")
	cmd.flags.StringVar(&cmd.storageHostNames, "storage-host-name", "", "Storage host name")

	//usage on -help
	cmd.flags.Usage = func() {
		fmt.Println(`
Add new node to be managed by Heketi

USAGE
  heketi-cli node add [options]

OPTIONS`)

		//print flags
		cmd.flags.PrintDefaults()
		fmt.Println(`
EXAMPLES
  $ heketi-cli node add \
      -zone=3 \
      -cluster=3e098cb4407d7109806bb196d9e8f095 \
      -management-host-name=node1-manage.gluster.lab.com \
      -storage-host-name=node1-storage.gluster.lab.com
`)
	}
	godbc.Ensure(cmd.name == "add")

	return cmd
}

func (n *NodeAddCommand) Exec(args []string) error {

	// Parse args
	n.flags.Parse(args)

	// Check arguments
	if n.zone == -1 {
		return errors.New("Missing zone")
	}
	if n.managmentHostNames == "" {
		return errors.New("Missing management hostname")
	}
	if n.storageHostNames == "" {
		return errors.New("Missing storage hostname")
	}
	if n.clusterId == "" {
		return errors.New("Missing cluster id")
	}

	// Create request blob
	req := &glusterfs.NodeAddRequest{}
	req.ClusterId = n.clusterId
	req.Hostnames.Manage = []string{n.managmentHostNames}
	req.Hostnames.Storage = []string{n.storageHostNames}
	req.Zone = n.zone

	// Create a client
	heketi := client.NewClient(n.options.Url, n.options.User, n.options.Key)

	// Add node
	node, err := heketi.NodeAdd(req)
	if err != nil {
		return err
	}

	if n.options.Json {
		data, err := json.Marshal(node)
		if err != nil {
			return err
		}
		fmt.Fprintf(stdout, string(data))
	} else {
		fmt.Fprintf(stdout, "Node information:\n"+
			"Id: %v\n"+
			"Cluster Id: %v\n"+
			"Zone: %v\n"+
			"Management Hostname %v\n"+
			"Storage Hostname %v\n",
			node.Id,
			node.ClusterId,
			node.Zone,
			node.Hostnames.Manage[0],
			node.Hostnames.Storage[0])
	}
	return nil
}

repository: manjuprasadshettyn/heketi

repo_name: manjuprasadshettyn/heketi


text:
package profanity

// Logger are the methods required on the logger.
type Logger interface {
	Printf(string, ...interface{})
	Errorf(string, ...interface{})
}

repository: sourya/go-sdk

repo_name: sourya/go-sdk


text:
SUMMARY = "Realtek 802.11n WLAN Adapter Linux driver"
LICENSE = "GPL-2.0-only"
LIC_FILES_CHKSUM = "file://Kconfig;md5=4b85004ff83dd932ff28f7f348fb2a28"
FILESEXTRAPATHS:prepend := "${THISDIR}/${PN}:"

inherit module

SRC_URI = " \
	git://github.com/gordboy/rtl8812au.git;protocol=https;branch=master \
	file://0001-Use-modules_install-as-wanted-by-yocto.patch \
"

SRCREV = "30d47a0a3f43ccb19e8fd59fe93d74a955147bf2"

S = "${WORKDIR}/git"

EXTRA_OEMAKE:append = " KSRC=${STAGING_KERNEL_DIR}"


text:
SUMMARY = "Tepl library eases the development of GtkSourceView-based projects"
LICENSE = "LGPLv2.1"
LIC_FILES_CHKSUM = "file://COPYING;md5=4fbd65380cdd255951079008b364516c"

DEPENDS = " \
    glib-2.0-native \
    gtk+3 \
    gtksourceview4 \
    amtk \
    libxml2 \
    uchardet \
"

inherit gnomebase gobject-introspection gettext

SRC_URI[archive.md5sum] = "013ee8aae178f75cc74e05fac70786b3"
SRC_URI[archive.sha256sum] = "e6f6673a8a27e8f280725db8fbacec79b20676ae0558755239d15a9808faa256"

repository: ni/meta-openembedded

repo_name: ni/meta-openembedded

branch_name: refs/heads/nilrt/master/hardknott


text:
@book{Darvill,
 ISBN-13 = {9780199534043},
 URL = {http://www.oxfordreference.com/abstract/10.1093/acref/9780199534043.001.0001/acref-9780199534043-e-4824?rskey=ttkVxJ&result=2080},
 author = {Timothy Darvill},
 publisher = {Oxford University Press},
 title = {The Concise Oxford Dictionary of Archeaology},
 edition = {2},
 year = {2008}
}

@article{Hill,
 ISSN = {02677504, 20549199},
 URL = {http://www.jstor.org/stable/42662641},
 author = {PHILIP V. HILL},
 journal = {The Numismatic Chronicle and Journal of the Royal Numismatic Society},
 pages = {125--142},
 publisher = {Royal Numismatic Society},
 title = {THE TEMPLES AND STATUES OF APOLLO IN ROME},
 volume = {2},
 year = {1962}
}

@blog{JV99,
 URL = {https://blogs.kent.ac.uk/lucius-romans/2017/06/13/the-temple-of-apollo-medicus-sosianus-restoration-and-politics-under-augustus/#},
 author = {Mark Crittenden},
 publisher = {University of Kent},
 title = {The Temple of Apollo Medicus Sosianus: Restoration and Politics under Augustus},
 year = {2017}
}

@book{PlatnerAshby,
title = { A topographical dictionary of ancient Rome },
author = { Platner, Samuel Ball and Ashby, Thomas, 1874-1931 },
url = { http://www.perseus.tufts.edu/PR/platner.ann.html },
publisher = { London : Oxford university press, H. Milford },
year = { 1929 },
type = { Book; Book/Illustrated },
subjects = { Antiquities; Travel; Rome -- Antiquities; Rome (Italy) -- Antiquities -- Dictionaries; Rome (Italy) -- Description and travel; Rome (Italy) -- Antiquities; Italy -- Rome; Rome -- Dictionaries },
language = { English },
note = { Includes index },
catalogue-url = { https://trove.nla.gov.au/work/6895282 }
}

@article{Sanders,
 URL = {https://scholarworks.bgsu.edu/honorsprojects/281},
 author = {Alisha Sanders},
 university = {Bowling Green State University, Honours Project},
 department = {School of Art},
 pages = {281},
 title = {Roman Archaism in Depictions of Apollo in the Augustan Period},
 year = {2016}
}

@article{Wiseman,
author = {Wiseman, T.P.},
year = {2014},
pages = {327-338},
title = {The Temple of Apollo and Diana in Rome},
volume = {33},
journal = {Oxford Journal of Archaeology},
url = {https://www.researchgate.net/publication/263776064_The_Temple_of_Apollo_and_Diana_in_Rome}
}

@Book{Zanker,
title = { The power of images in the Age of Augustus },
author = { Paul Zanker },
url = { http://openlibrary.org/books/OL18314706M },
publisher = { Ann Arbor University of Michigan Press },
year = { 1990 },
edition = { 1st pbk. ed },
isbn = { 0472081241 },
subjects = { Augustus, -- Emperor of Rome, -- 63 B.C.-14 A.D; Art, Roman -- Themes, motives; Rome -- History -- Augustus, 30 B.C.-14 A.D },
note = { Includes bibliographical references (p. 341-370) and index },
catalogue-url = { https://trove.nla.gov.au/work/18630759 }
}

@article{Zink,
title = {Reconstructing the Palatine temple of Apollo: a case study in early Augustan temple design},
volume = {21},
url = {https://www.cambridge.org/core/journals/journal-of-roman-archaeology/article/reconstructing-the-palatine-temple-of-apollo-a-case-study-in-early-augustan-temple-design/352566D31141462F14B9D71926FD33AC},
journal = {Journal of Roman Archaeology},
publisher = {Cambridge University Press},
author = {Zink, Stephan},
year = {2008},
pages = {47–63}
}

repository: mqAncientHistory/cityOfRome

repo_name: mqAncientHistory/cityOfRome

gha_language: HTML


text:
DESCRIPTION = "The NTFS-3G driver is an open source, freely available NTFS driver for Linux with read and write support."
HOMEPAGE = "http://www.ntfs-3g.org/"
DEPENDS = "fuse libgcrypt"
PROVIDES = "ntfsprogs ntfs-3g"
LICENSE = "GPL-2.0-only & LGPL-2.0-only"
LIC_FILES_CHKSUM = "file://COPYING;md5=59530bdf33659b29e73d4adb9f9f6552 \
                    file://COPYING.LIB;md5=f30a9716ef3762e3467a2f62bf790f0a"

SRC_URI = "http://tuxera.com/opensource/ntfs-3g_ntfsprogs-${PV}.tgz \
           file://0001-libntfs-3g-Makefile.am-fix-install-failed-while-host.patch \
"
S = "${WORKDIR}/ntfs-3g_ntfsprogs-${PV}"
SRC_URI[sha256sum] = "f20e36ee68074b845e3629e6bced4706ad053804cbaf062fbae60738f854170c"

UPSTREAM_CHECK_URI = "https://www.tuxera.com/community/open-source-ntfs-3g/"
UPSTREAM_CHECK_REGEX = "ntfs-3g_ntfsprogs-(?P<pver>\d+(\.\d+)+)\.tgz"

inherit autotools pkgconfig

PACKAGECONFIG ??= ""
PACKAGECONFIG[uuid] = "--with-uuid,--without-uuid,util-linux"

# required or it calls ldconfig at install step
EXTRA_OEMAKE = "LDCONFIG=echo"

PACKAGES =+ "ntfs-3g ntfsprogs libntfs-3g"

FILES:ntfs-3g = "${base_sbindir}/*.ntfs-3g ${bindir}/ntfs-3g* ${base_sbindir}/mount.ntfs"
RDEPENDS:ntfs-3g += "fuse"
RRECOMMENDS:ntfs-3g = "util-linux-mount"

FILES:ntfsprogs = "${base_sbindir}/* ${bindir}/* ${sbindir}/*"
FILES:libntfs-3g = "${libdir}/*${SOLIBS}"

do_install:append() {
    # Standard mount will execute the program /sbin/mount.TYPE when called.
    # Add a symbolic link to let mount find ntfs.
    ln -sf mount.ntfs-3g ${D}${base_sbindir}/mount.ntfs
    rmdir ${D}${libdir}/ntfs-3g

    # Handle when usrmerge is in effect. Some files are installed to /sbin
    # regardless of the value of ${base_sbindir}.
    if [ "${base_sbindir}" != /sbin ] && [ -d ${D}/sbin ]; then
        mkdir -p ${D}${base_sbindir}
        mv ${D}/sbin/* ${D}${base_sbindir}
        rmdir ${D}/sbin
    fi
}

# Satisfy the -dev runtime dependency
ALLOW_EMPTY:${PN} = "1"

CVE_PRODUCT = "tuxera:ntfs-3g"

repository: openembedded/meta-openembedded

repo_name: openembedded/meta-openembedded


text:
@article{Wheater-2022-Advances,
    title = "Advances in modelling large river basins in cold regions with Mod{\'e}lisation Environmentale Communautaire{---}Surface and Hydrology (MESH), the Canadian hydrological land surface scheme",
    author = "Wheater, Howard S.  and
      Pomeroy, John W.  and
      Pietroniro, Alain  and
      Davison, Bruce  and
      Elshamy, Mohamed  and
      Yassin, Fuad  and
      Rokaya, Prabin  and
      Fayad, Abbas  and
      Tesemma, Zelalem  and
      Princz, Daniel  and
      Loukili, Youssef  and
      DeBeer, Chris M.  and
      Ireson, Andrew M.  and
      Razavi, Saman  and
      Lindenschmidt, Karl‐Erich  and
      Elshorbagy, Amin  and
      MacDonald, Matthew  and
      Abdelhamed, Mohamed  and
      Haghnegahdar, Amin  and
      Bahrami, Ala",
    journal = "Hydrological Processes, Volume 36, Issue 4",
    volume = "36",
    number = "4",
    year = "2022",
    publisher = "Wiley",
    url = "https://aclanthology.org/G22-85001",
    doi = "10.1002/hyp.14557",
    abstract = "Cold regions provide water resources for half the global population yet face rapid change. Their hydrology is dominated by snow, ice and frozen soils, and climate warming is having profound effects. Hydrological models have a key role in predicting changing water resources but are challenged in cold regions. Ground-based data to quantify meteorological forcing and constrain model parameterization are limited, while hydrological processes are complex, often controlled by phase change energetics. River flows are impacted by poorly quantified human activities. This paper discusses the scientific and technical challenges of the large-scale modelling of cold region systems and reports recent modelling developments, focussing on MESH, the Canadian community hydrological land surface scheme. New cold region process representations include improved blowing snow transport and sublimation, lateral land-surface flow, prairie pothole pond storage dynamics, frozen ground infiltration and thermodynamics, and improved glacier modelling. New algorithms to represent water management include multistage reservoir operation. Parameterization has been supported by field observations and remotely sensed data; new methods for parameter identification have been used to evaluate model uncertainty and support regionalization. Additionally, MESH has been linked to broader decision-support frameworks, including river ice simulation and hydrological forecasting. The paper also reports various applications to the Saskatchewan and Mackenzie River basins in western Canada (0.4 and 1.8 million km2). These basins arise in glaciated mountain headwaters, are partly underlain by permafrost, and include remote and incompletely understood forested, wetland, agricultural and tundra ecoregions. These illustrate the current capabilities and limitations of cold region modelling, and the extraordinary challenges to prediction, including the need to overcoming biases in forcing data sets, which can have disproportionate effects on the simulated hydrology.",
}

repository: gwf-uwaterloo/gwf-publications

repo_name: gwf-uwaterloo/gwf-publications

branch_name: refs/heads/main

gha_language: Python