Giter Site home page Giter Site logo

auracle's Introduction

What is Auracle?

Auracle is a command line tool used to interact with Arch Linux's User Repository, commonly referred to as the AUR.

Auracle supersedes my previous efforts in developing cower, a tool with a similar purpose. I've started anew mainly as a result of frustrations over the years with how cower has developed, and limitations I've run into.

Background

At the core of any AUR client is a series of HTTP requests to the AUR. cower currently implements this using the venerable libcurl. Libcurl, generally speaking, offers two APIs: "easy" and "multi". The easy API uses a CURL handle to represent a session. Each handle manages approximately 1 active request at a given time. The multi API aggregates multiple easy handles, allowing for concurrent sessions in a non-blocking (event-like) manner.

It's also possible to achieve session concurrency through anothers means, which is to use threads with multiple CURL handles, but solely through the easy API. In this mode, one must be careful never to access the same CURL handle concurrently, as the objects are not thread-safe.

Problem

History has taught me that the handle-per-thread approach was a poor choice. cower (loosely) implements a thread pool, and multiplexes requests across some number of threads. Information is generally shared through light use of mutexes around global objects (mainly, a work queue), and results from threads are aggregated back in the main thread.

Due to my decision to write cower in C and ensuing laziness, there's other warts. Data structures are ill-chosen, typically using the doubly-linked list from alpm. Encapsulation is poor, and there's numerous objects which have some vague amount of overlap, or end up being global for the sake of sharing.

Lack of proper communication channels (or any real synchronization) between threads has lead to relatively unfixable bugs. And, the current architecture makes it difficult to implement obvious improvements.

The cower codebase has simply become frustrating to work with.

Solution

I've attempted to address some of these faults through refactoring. There's some obvious (to me) abstractions to be created, but the added difficulty presented by the current threading architecture and yearn for actual data structures (without having to write/find them) gives me pause.

Therefore, the ideal state seems to be to move away from threads and rewrite in a higher level language. auracle attempts to address these problems and more through it's C++ implementation and adoption of Curl's multi API.

This code is all subject to change until a tag is pushed. If you have opinions, feature requests, or bug reports, please file issues.

Building and Testing

Building auracle requires:

  • A C++17 compiler
  • meson
  • libsystemd
  • libalpm
  • libarchive
  • libcurl

Testing additionally depends on:

  • gmock
  • gtest
  • python3

You're probably building this from the AUR, though, so just go use the PKGBUILD.

If you're hacking on auracle, you can do this manually:

$ meson build
$ ninja -C build

And running the tests is simply a matter of:

$ meson test -C build

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.