Table of Contents
Why did we Go with Go?
mgo

Go Agent, Go

Jun 07, 2016 pm 04:30 PM
agent Hacker news

Discuss on Hacker News 10gen introduced MongoDB Backup Service in early May. Creating a backup service for MongoDB was a new challenge, and we used the opportunity to explore new technologies for our stack. The final implementation of the

Discuss on Hacker News

10gen introduced MongoDB Backup Service in early May. Creating a backup service for MongoDB was a new challenge, and we used the opportunity to explore new technologies for our stack. The final implementation of the MongoDB Backup Service agent is written in Go, an open-source, natively executable language initiated and maintained by Google.

Why did we Go with Go?

The Backup Service started as a Java project, but as the project matured, the team wanted to move to a language that compiled natively on the machine. After considering a few options, the team decided that Go was the best fit for its C-like syntax, strong standard library, the resolution of concurrency problems via goroutines, and painless multi-platform distribution.

mgo

As an open-source company, 10gen is fortunate to work with MongoDB developers around the world who build open-source tools for new and emerging languages to provide users with a breadth of options to access MongoDB. One of the MongoDB Masters, Gustavo Niemeyer, has spent over two years building mgo, the MongoDB driver for Go. In that time he’s developed a great framework for accessing MongoDB through Go and Gustavo has been a valuable resource as we’ve built out the Backup Service. In his own words:

“It’s great to see not only 10gen making good use of the Go language for first-class services, but contributing to that community of developers by providing its support for the development of the Go driver in multiple ways.”

Programming the backup agent in Go and the mgo driver has been extremely satisfying. Between the lightweight syntax, the first-class concurrency and the well documented, idiomatic libraries such as mgo, Go is a great choice for writing anything from small scripts to large distributed applications.

Starting a Java project often begins with a group debate: “Maven or Ant? JUnit or TestNG? Spring or Guice?” Go has a number of conventions through which Go team has created a sensible, uniform development experience with the holy trinity of tools: go build, test and fmt.

  • The organization of source code and libraries is standardized to allow using the go build tool. See details here

  • Name test files as XXX_test.go with functions named TestXXX can be run automatically with go test

  • Braces are required on if statements and the first brace goes along with the if condition. E.g.

if x {
     doSomething()
}
Copy after login

instead of:

if x 
{
    doSomething()
}
Copy after login
  • Methods that end with an f (e.g. Printf, Fatalf) means a string formatted method will be validated in go vet that the number of substitutions (e.g. %v) matches the number of inputs to the function.

mgo is a real pleasure to use with high-quality code, thorough documentation and an API that is a thoughtful, natural blend of idiomatic Go and MongoDB.?Our team owes a lot of thanks to Gustavo for his hard work on this project.

There are other Go projects being explored at the moment and we hope to see more people using mgo in production going forward.

By the 10gen Backup Team

Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

Fudan NLP team released an 80-page overview of large-scale model agents, providing an overview of the current situation and future of AI agents in one article Fudan NLP team released an 80-page overview of large-scale model agents, providing an overview of the current situation and future of AI agents in one article Sep 23, 2023 am 09:01 AM

Recently, the Fudan University Natural Language Processing Team (FudanNLP) launched a review paper on LLM-basedAgents. The full text is 86 pages long and has more than 600 references! Starting from the history of AIAgent, the authors comprehensively sort out the current status of intelligent agents based on large-scale language models, including: the background, composition, application scenarios of LLM-basedAgent, and the agent society that has attracted much attention. At the same time, the authors discussed forward-looking and open issues related to Agent, which are of great value to the future development trends of related fields. Paper link: https://arxiv.org/pdf/2309.07864.pdfLLM-basedAgent paper list:

Tornado Cash Used in Rain Exchange Hack Tornado Cash Used in Rain Exchange Hack Aug 08, 2024 am 06:15 AM

Security firm PeckShield noted that the hacker withdrew 1,155 Ether to Tornado Cash, an unregulated crypto mixer. This platform employs cryptographic methods to ensure that the transactions are not easily traceable.

How to use Java Agent How to use Java Agent May 22, 2023 pm 08:52 PM

Introduction to JavaAgent technology JavaAgent is literally translated as Java agent, and is often called Java probe technology. JavaAgent was introduced in JDK1.5 and is a technology that can dynamically modify Java bytecode. Classes in Java are compiled to form bytecodes that are executed by the JVM. The JVM obtains the information of these bytecodes before executing these bytecodes, and modifies these bytecodes through a bytecode converter to complete the process. Some extra features. JavaAgent is a jar package that cannot run independently. It works through the JVM process attached to the target program. When starting, you only need to add the -javaagent parameter to the startup parameters of the target program to add Cla

Several design patterns that excellent agents must learn, you can learn them in one go Several design patterns that excellent agents must learn, you can learn them in one go May 30, 2024 am 09:44 AM

Hello everyone, I am Lao Du. Yesterday, I listened to the AI ​​hospital town shared by Tsinghua University Intelligent Industry Research Institute at the company. Picture: This is a virtual world. All doctors, nurses, and patients are Agents driven by LLM and can interact independently. They simulated the entire process of diagnosis and treatment, and achieved a state-of-the-art accuracy of 93.06% on a subset of the MedQA data set covering major respiratory diseases. An excellent intelligent agent is inseparable from excellent design patterns. After reading this case, I quickly read the four main Agent design patterns recently published by Mr. Andrew Ng. Andrew Ng is one of the most authoritative scholars in the world in the field of artificial intelligence and machine learning. Then, I quickly compiled it and shared it with everyone. Mode 1. Reflection

Hacker Returns $19 Million of Crypto Looted From US Government Wallet, Arkham Says Hacker Returns $19 Million of Crypto Looted From US Government Wallet, Arkham Says Oct 27, 2024 am 04:12 AM

The hacker who looted nearly $22 million worth of crypto from a US government wallet this week appears to have returned the vast majority of the funds

Hacker Returns $19.3 Million to U.S. Government Wallet Less Than 24 Hours After Stealing Almost $20 Million Hacker Returns $19.3 Million to U.S. Government Wallet Less Than 24 Hours After Stealing Almost $20 Million Oct 26, 2024 pm 06:20 PM

According to Arkham Intelligence, the hacker’s wallets, beginning with the characters “0xc9E,” sent the funds back to the US government’s wallet.

Web3 Phishing Attack Results in the Loss of $55 Million Worth of Dai Tokens Web3 Phishing Attack Results in the Loss of $55 Million Worth of Dai Tokens Aug 22, 2024 am 09:36 AM

This recent incident highlights vulnerabilities in the security of digital assets. It also illustrates the broader trend of increasing cybercrime victims in the Web3 domain.

Microsoft and Amazon bring Xbox Gaming to Fire TV devices Microsoft and Amazon bring Xbox Gaming to Fire TV devices Jun 28, 2024 am 08:06 AM

Microsoft’s Xbox Cloud Gaming service is available on various devices including PCs, phones, and select TVs. Now, the service will be available to a lot more users via Fire TV Sticks, thanks to a collaboration between Microsoft and Amazon.Working For

See all articles