Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The Big Rebuild #280

Open
Southclaws opened this issue Dec 26, 2018 · 1 comment
Open

The Big Rebuild #280

Southclaws opened this issue Dec 26, 2018 · 1 comment
Labels

Comments

@Southclaws
Copy link
Owner

This is a roadmap to 2.0 which will also be a partial rewrite of the codebase (mostly a restructure). There are many open issues that the current codebase makes difficult to implement and test properly - due to the monolithic nature of each component.

v2 will involve a much more idiomatic Go package structure with use of interfaces. Back when I first wrote sampctl, Go was still a relatively new language to me and interfaces were the one remaining language concept I didn't have enough confidence in to use in a widely used tool.

The biggest proposed change is the introduction of the Dependency Interface. This means writing the same code and using the same dependency resolution algorithm for all components, not just Pawn source:

  • Pawn libraries
  • Pawn entry scripts
  • Server binaries
  • Server plugins
  • Arbitrary files (GPS data, GeoIP data, Heightmap data, etc)
  • Pawn compilers
  • Rust-based plugins
  • Lua scripts (cc @IllidanS4)

This will require gathering together all the attributes of these assets in their current form and modelling a generic "Dependency" (or "Node", since it's a tree...) structure which can then be implemented for each of these types.

I'm thinking this will likely be a good first pass:

type Resource interface {
	Version() (version string)                    // The resource version
	Cached(version string) (is bool, path string) // Get cached path is present
	Ensure(version, path string) (err error)      // Acquire if necessary
}

This should work for Git repositories, GitHub release assets and arbitrary HTTP file downloads. Which covers all of the above mentioned types of dependency.

@Southclaws Southclaws pinned this issue Dec 26, 2018
@Southclaws Southclaws unpinned this issue Apr 11, 2019
@ADRFranklin
Copy link
Collaborator

So what you are saying is, that every type of dependency should implement the resource interface, which allows a very fine control of how each dependency should ensure, and cache itself.

Could you go into further explanation of how you expect a node based pattern to be used here?

@ADRFranklin ADRFranklin added the v2 label May 9, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants