-
Notifications
You must be signed in to change notification settings - Fork 442
RFC: Backend models
Jacob Michalskie edited this page Mar 18, 2024
·
3 revisions
Approved by:
OBS uses multiple ways to parse XML it receives from the backend
We have multiple parsing abstractions like:
- ActiveModel (ex. LocalBuildResult, Patchinfo)
- Xmlhash objects (ex. Directory, many Controllers)
- Nokogiri objects (API controllers)
- REXML objects (API controllers)
This happens everywhere within the code base.
- We have to context switch with every single instance of a backend response we encounter
- It's not clear which solution is the preferred one for new code
- Results from the Xmlhash, Nokogiri and REXML approaches behave like a low level Hash object that contains other low level data types (String, Hash, Array). This often leads to more "low level"/complex code to manipulate/transform the hash and it's content.
- There is one preferred way to parse the backend responses, with an adequate backend library that gives us a parsed response directly
- We can specify the structure of the XML declaratively, and directly use it to parse the responses
Code wise, this is the POC: https://github.com/openSUSE/open-build-service/compare/master...hellcp-work:open-build-service:backend-models-poc. Besides introducing the gem and the structure, the aim of it was to present an initial, more readable replacement for https://github.com/openSUSE/open-build-service/blob/master/src/api/app/models/local_build_result/for_package.rb
Introducing this more widely into the code base would require:
- Implementing new Backend::Xml responses
- Implementing required Backend models
- Replacing existing backend call + parser with Backend model methods
- Whenever we still need string output, we keep using Backend::Api
https://etherpad.opensuse.org/p/obs-backend-models-rendering
- Development Environment Overview
- Development Environment Tips & Tricks
- Spec-Tips
- Code Style
- Rubocop
- Testing with VCR
- Authentication
- Authorization
- Autocomplete
- BS Requests
- Events
- ProjectLog
- Notifications
- Feature Toggles
- Build Results
- Attrib classes
- Flags
- The BackendPackage Cache
- Maintenance classes
- Cloud uploader
- Delayed Jobs
- Staging Workflow
- StatusHistory
- OBS API
- Owner Search
- Search
- Links
- Distributions
- Repository
- Data Migrations
- next_rails
- Ruby Update
- Rails Profiling
- Installing a local LDAP-server
- Remote Pairing Setup Guide
- Factory Dashboard
- osc
- Setup an OBS Development Environment on macOS
- Run OpenQA smoketest locally
- Responsive Guidelines
- Importing database dumps
- Problem Statement & Solution
- Kickoff New Stuff
- New Swagger API doc
- Documentation and Communication
- GitHub Actions
- How to Introduce Software Design Patterns
- Query Objects
- Services
- View Components
- RFC: Core Components
- RFC: Decorator Pattern
- RFC: Backend models