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

Move parts of the project over to rivershared (monorepo alternative) #429

Merged
merged 1 commit into from
Jul 7, 2024

Conversation

brandur
Copy link
Contributor

@brandur brandur commented Jul 7, 2024

As discussed over Slack, we've been having trouble wherein we often find
ourselves needing pieces of the main River Go project over in other
projects like River UI, and having to copy a bunch of stuff over.

Here, we establish a new rivershared Go Module in the main River
project, then move references to it from other main modules over to it.

Basically my methodology for this one is that I'd been working on the
plugin system, wanted to see if startstop.Service could be moved so we
didn't have to duplicate it in rivertype, moved it to rivershared,
then moved all of its dependencies over to rivershared as well. (Most
of these dependencies come from startstop's test suite.)

Copy link
Contributor

@bgentry bgentry left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice, thanks for taking care of this!

rivershared/riversharedtest/riversharedtest.go Outdated Show resolved Hide resolved
As discussed over Slack, we've been having trouble wherein we often find
ourselves needing pieces of the main River Go project over in other
projects like River UI, and having to copy a bunch of stuff over.

Here, we establish a new `rivershared` Go Module in the main River
project, then move references to it from other main modules over to it.

Basically my methodology for this one is that I'd been working on the
plugin system, wanted to see if `startstop.Service` could be moved so we
didn't have to duplicate it in `rivertype`, moved it to `rivershared`,
then moved all of its dependencies over to `rivershared` as well. (Most
of these dependencies come from `startstop`'s test suite.)
@brandur
Copy link
Contributor Author

brandur commented Jul 7, 2024

Awesome. Alright let's give this a shot.

@brandur brandur merged commit 81709ed into master Jul 7, 2024
10 checks passed
@brandur brandur deleted the brandur-river-shared-2 branch July 7, 2024 19:45
brandur added a commit that referenced this pull request Jul 7, 2024
Here, follow up #429 to add a basic plugin system for River clients
which allows a driver to add maintenance and non-maintenance services to
a client before it starts up. The plugin interface is this:

    type Plugin interface {
        // MaintenanceServices returns additional maintenance services (will only
        // run on an elected leader) for a River client.
        MaintenanceServices() []startstop.Service

        // Services returns additional non-maintenance services (will run on all
        // clients) for a River client.
        Services() []startstop.Service
    }

The change is fairly straightforward, and we make sure to bring in some
test cases verifying the plugin services were indeed added correctly.
brandur added a commit that referenced this pull request Jul 7, 2024
Here, follow up #429 to add a basic plugin system for River clients
which allows a driver to add maintenance and non-maintenance services to
a client before it starts up. The plugin interface is implemented by the
drivers themselves, and looks like this:

    type driverPlugin[TTx any] interface {
        // PluginInit initializes a plugin with an archetype and client. It's
        // invoked on Client.NewClient.
        PluginInit(archetype *baseservice.Archetype, client *Client[TTx])

        // PluginMaintenanceServices returns additional maintenance services (will
        // only run on an elected leader) for a River client.
        PluginMaintenanceServices() []startstop.Service

        // PluginServices returns additional non-maintenance services (will run on
        // all clients) for a River client.
        PluginServices() []startstop.Service
    }

The change is fairly straightforward, and we make sure to bring in some
test cases verifying the plugin services were indeed added correctly.
brandur added a commit that referenced this pull request Jul 7, 2024
Here, follow up #429 to add a basic plugin system for River clients
which allows a driver to add maintenance and non-maintenance services to
a client before it starts up. The plugin interface is implemented by the
drivers themselves, and looks like this:

    type driverPlugin[TTx any] interface {
        // PluginInit initializes a plugin with an archetype and client. It's
        // invoked on Client.NewClient.
        PluginInit(archetype *baseservice.Archetype, client *Client[TTx])

        // PluginMaintenanceServices returns additional maintenance services (will
        // only run on an elected leader) for a River client.
        PluginMaintenanceServices() []startstop.Service

        // PluginServices returns additional non-maintenance services (will run on
        // all clients) for a River client.
        PluginServices() []startstop.Service
    }

The change is fairly straightforward, and we make sure to bring in some
test cases verifying the plugin services were indeed added correctly.
brandur added a commit that referenced this pull request Jul 7, 2024
Here, follow up #429 to add a basic plugin system for River clients
which allows a driver to add maintenance and non-maintenance services to
a client before it starts up. The plugin interface is implemented by the
drivers themselves, and looks like this:

    type driverPlugin[TTx any] interface {
        // PluginInit initializes a plugin with an archetype and client. It's
        // invoked on Client.NewClient.
        PluginInit(archetype *baseservice.Archetype, client *Client[TTx])

        // PluginMaintenanceServices returns additional maintenance services (will
        // only run on an elected leader) for a River client.
        PluginMaintenanceServices() []startstop.Service

        // PluginServices returns additional non-maintenance services (will run on
        // all clients) for a River client.
        PluginServices() []startstop.Service
    }

The change is fairly straightforward, and we make sure to bring in some
test cases verifying the plugin services were indeed added correctly.
brandur added a commit that referenced this pull request Jul 7, 2024
Here, follow up #429 to add a basic plugin system for River clients
which allows a driver to add maintenance and non-maintenance services to
a client before it starts up. The plugin interface is implemented by the
drivers themselves, and looks like this:

    type driverPlugin[TTx any] interface {
        // PluginInit initializes a plugin with an archetype and client. It's
        // invoked on Client.NewClient.
        PluginInit(archetype *baseservice.Archetype, client *Client[TTx])

        // PluginMaintenanceServices returns additional maintenance services (will
        // only run on an elected leader) for a River client.
        PluginMaintenanceServices() []startstop.Service

        // PluginServices returns additional non-maintenance services (will run on
        // all clients) for a River client.
        PluginServices() []startstop.Service
    }

The change is fairly straightforward, and we make sure to bring in some
test cases verifying the plugin services were indeed added correctly.
brandur added a commit that referenced this pull request Jul 7, 2024
Here, follow up #429 to add a basic plugin system for River clients
which allows a driver to add maintenance and non-maintenance services to
a client before it starts up. The plugin interface is implemented by the
drivers themselves, and looks like this:

    type driverPlugin[TTx any] interface {
        // PluginInit initializes a plugin with an archetype and client. It's
        // invoked on Client.NewClient.
        PluginInit(archetype *baseservice.Archetype, client *Client[TTx])

        // PluginMaintenanceServices returns additional maintenance services (will
        // only run on an elected leader) for a River client.
        PluginMaintenanceServices() []startstop.Service

        // PluginServices returns additional non-maintenance services (will run on
        // all clients) for a River client.
        PluginServices() []startstop.Service
    }

The change is fairly straightforward, and we make sure to bring in some
test cases verifying the plugin services were indeed added correctly.
brandur added a commit that referenced this pull request Jul 7, 2024
This is a follow up from #429 this morning. I moved `slogtest` and
`startstoptest` over to the new `rivershared` module, but then forgot to
remove the existing ones out of the main River module. Here, do that.
All references have already been updated.
brandur added a commit that referenced this pull request Jul 8, 2024
Small change to follow up #429 that makes sure that we also update
`rivershared`'s `go.mod` with changing internal package versions prior
to release.
brandur added a commit that referenced this pull request Jul 8, 2024
This is a follow up from #429 this morning. I moved `slogtest` and
`startstoptest` over to the new `rivershared` module, but then forgot to
remove the existing ones out of the main River module. Here, do that.
All references have already been updated.
brandur added a commit that referenced this pull request Jul 8, 2024
Small change to follow up #429 that makes sure that we also update
`rivershared`'s `go.mod` with changing internal package versions prior
to release.
brandur added a commit that referenced this pull request Jul 8, 2024
Here, follow up #429 to add a basic plugin system for River clients
which allows a driver to add maintenance and non-maintenance services to
a client before it starts up. The plugin interface is implemented by the
drivers themselves, and looks like this:

    type driverPlugin[TTx any] interface {
        // PluginInit initializes a plugin with an archetype and client. It's
        // invoked on Client.NewClient.
        PluginInit(archetype *baseservice.Archetype, client *Client[TTx])

        // PluginMaintenanceServices returns additional maintenance services (will
        // only run on an elected leader) for a River client.
        PluginMaintenanceServices() []startstop.Service

        // PluginServices returns additional non-maintenance services (will run on
        // all clients) for a River client.
        PluginServices() []startstop.Service
    }

The change is fairly straightforward, and we make sure to bring in some
test cases verifying the plugin services were indeed added correctly.
brandur added a commit that referenced this pull request Jul 8, 2024
Small change to follow up #429 that makes sure that we also update
`rivershared`'s `go.mod` with changing internal package versions prior
to release.
brandur added a commit that referenced this pull request Jul 8, 2024
Add basic plugin system for clients

Here, follow up #429 to add a basic plugin system for River clients
which allows a driver to add maintenance and non-maintenance services to
a client before it starts up. The plugin interface is implemented by the
drivers themselves, and looks like this:

    type driverPlugin[TTx any] interface {
        // PluginInit initializes a plugin with an archetype and client. It's
        // invoked on Client.NewClient.
        PluginInit(archetype *baseservice.Archetype, client *Client[TTx])

        // PluginMaintenanceServices returns additional maintenance services (will
        // only run on an elected leader) for a River client.
        PluginMaintenanceServices() []startstop.Service

        // PluginServices returns additional non-maintenance services (will run on
        // all clients) for a River client.
        PluginServices() []startstop.Service
    }

The change is fairly straightforward, and we make sure to bring in some
test cases verifying the plugin services were indeed added correctly.

---------

Co-authored-by: Blake Gentry <blakesgentry@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants