Skip to content

Commit

Permalink
services/horizon: Move toid package to root directory (#4215)
Browse files Browse the repository at this point in the history
Move `toid` package to root directory from Horizon's `internal` package.

`toid` can be useful in other services. It was also made a standard SEP:
https://github.com/stellar/stellar-protocol/blob/master/ecosystem/sep-0035.md
  • Loading branch information
bartekn authored Feb 4, 2022
1 parent 58cb21a commit ae4b37a
Show file tree
Hide file tree
Showing 32 changed files with 33 additions and 35 deletions.
2 changes: 1 addition & 1 deletion services/horizon/internal/actions/helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@ import (
"github.com/stellar/go/services/horizon/internal/db2"
"github.com/stellar/go/services/horizon/internal/ledger"
hProblem "github.com/stellar/go/services/horizon/internal/render/problem"
"github.com/stellar/go/services/horizon/internal/toid"
"github.com/stellar/go/support/errors"
"github.com/stellar/go/support/render/problem"
"github.com/stellar/go/toid"
"github.com/stellar/go/xdr"
)

Expand Down
2 changes: 1 addition & 1 deletion services/horizon/internal/actions/helpers_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@ import (
"github.com/stellar/go/services/horizon/internal/db2"
"github.com/stellar/go/services/horizon/internal/ledger"
"github.com/stellar/go/services/horizon/internal/test"
"github.com/stellar/go/services/horizon/internal/toid"
"github.com/stellar/go/support/db"
"github.com/stellar/go/support/errors"
"github.com/stellar/go/support/render/problem"
"github.com/stellar/go/toid"
"github.com/stellar/go/xdr"
)

Expand Down
2 changes: 1 addition & 1 deletion services/horizon/internal/actions/operation.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@ import (
"github.com/stellar/go/services/horizon/internal/ledger"
"github.com/stellar/go/services/horizon/internal/render/problem"
"github.com/stellar/go/services/horizon/internal/resourceadapter"
"github.com/stellar/go/services/horizon/internal/toid"
"github.com/stellar/go/support/errors"
"github.com/stellar/go/support/render/hal"
supportProblem "github.com/stellar/go/support/render/problem"
"github.com/stellar/go/toid"
)

// Joinable query struct for join query parameter
Expand Down
2 changes: 1 addition & 1 deletion services/horizon/internal/db2/history/effect.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ import (

"github.com/stellar/go/protocols/horizon/effects"
"github.com/stellar/go/services/horizon/internal/db2"
"github.com/stellar/go/services/horizon/internal/toid"
"github.com/stellar/go/support/errors"
"github.com/stellar/go/toid"
)

// UnmarshalDetails unmarshals the details of this effect into `dest`
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (

"github.com/guregu/null"
"github.com/stellar/go/services/horizon/internal/test"
"github.com/stellar/go/services/horizon/internal/toid"
"github.com/stellar/go/toid"
)

func TestAddEffect(t *testing.T) {
Expand Down
2 changes: 1 addition & 1 deletion services/horizon/internal/db2/history/effect_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import (
"github.com/stellar/go/protocols/horizon/effects"
"github.com/stellar/go/services/horizon/internal/db2"
"github.com/stellar/go/services/horizon/internal/test"
"github.com/stellar/go/services/horizon/internal/toid"
"github.com/stellar/go/toid"
)

func TestEffectsForLiquidityPool(t *testing.T) {
Expand Down
2 changes: 1 addition & 1 deletion services/horizon/internal/db2/history/fee_bump_scenario.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import (
"github.com/stellar/go/ingest"
"github.com/stellar/go/network"
"github.com/stellar/go/services/horizon/internal/test"
"github.com/stellar/go/services/horizon/internal/toid"
"github.com/stellar/go/toid"
"github.com/stellar/go/xdr"
"github.com/stretchr/testify/assert"
)
Expand Down
2 changes: 1 addition & 1 deletion services/horizon/internal/db2/history/ledger.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ import (
sq "github.com/Masterminds/squirrel"
"github.com/guregu/null"
"github.com/stellar/go/services/horizon/internal/db2"
"github.com/stellar/go/services/horizon/internal/toid"
"github.com/stellar/go/support/errors"
"github.com/stellar/go/toid"
"github.com/stellar/go/xdr"
)

Expand Down
2 changes: 1 addition & 1 deletion services/horizon/internal/db2/history/ledger_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import (
"github.com/guregu/null"
"github.com/stellar/go/ingest/ledgerbackend"
"github.com/stellar/go/services/horizon/internal/test"
"github.com/stellar/go/services/horizon/internal/toid"
"github.com/stellar/go/toid"
"github.com/stellar/go/xdr"
)

Expand Down
2 changes: 1 addition & 1 deletion services/horizon/internal/db2/history/operation.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ import (

sq "github.com/Masterminds/squirrel"
"github.com/stellar/go/services/horizon/internal/db2"
"github.com/stellar/go/services/horizon/internal/toid"
"github.com/stellar/go/support/errors"
"github.com/stellar/go/toid"
"github.com/stellar/go/xdr"
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (

"github.com/guregu/null"
"github.com/stellar/go/services/horizon/internal/test"
"github.com/stellar/go/services/horizon/internal/toid"
"github.com/stellar/go/toid"
"github.com/stellar/go/xdr"
)

Expand Down
2 changes: 1 addition & 1 deletion services/horizon/internal/db2/history/operation_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (
"github.com/guregu/null"
"github.com/stellar/go/services/horizon/internal/db2"
"github.com/stellar/go/services/horizon/internal/test"
"github.com/stellar/go/services/horizon/internal/toid"
"github.com/stellar/go/toid"
"github.com/stellar/go/xdr"
)

Expand Down
2 changes: 1 addition & 1 deletion services/horizon/internal/db2/history/trade_aggregation.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ import (
sq "github.com/Masterminds/squirrel"

"github.com/stellar/go/services/horizon/internal/db2"
"github.com/stellar/go/services/horizon/internal/toid"
"github.com/stellar/go/support/errors"
strtime "github.com/stellar/go/support/time"
"github.com/stellar/go/toid"
)

// AllowedResolutions is the set of trade aggregation time windows allowed to be used as the
Expand Down
2 changes: 1 addition & 1 deletion services/horizon/internal/db2/history/trade_scenario.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import (
"github.com/guregu/null"

"github.com/stellar/go/services/horizon/internal/test"
"github.com/stellar/go/services/horizon/internal/toid"
"github.com/stellar/go/toid"
"github.com/stellar/go/xdr"
)

Expand Down
2 changes: 1 addition & 1 deletion services/horizon/internal/db2/history/transaction.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ import (
sq "github.com/Masterminds/squirrel"

"github.com/stellar/go/services/horizon/internal/db2"
"github.com/stellar/go/services/horizon/internal/toid"
"github.com/stellar/go/support/errors"
"github.com/stellar/go/toid"
"github.com/stellar/go/xdr"
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@ import (
"github.com/lib/pq"

"github.com/stellar/go/ingest"
"github.com/stellar/go/services/horizon/internal/toid"
"github.com/stellar/go/services/horizon/internal/utf8"
"github.com/stellar/go/support/db"
"github.com/stellar/go/support/errors"
"github.com/stellar/go/toid"
"github.com/stellar/go/xdr"
)

Expand Down
2 changes: 1 addition & 1 deletion services/horizon/internal/db2/history/transaction_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import (

"github.com/stellar/go/ingest"
"github.com/stellar/go/services/horizon/internal/test"
"github.com/stellar/go/services/horizon/internal/toid"
"github.com/stellar/go/toid"
)

func TestTransactionQueries(t *testing.T) {
Expand Down
2 changes: 1 addition & 1 deletion services/horizon/internal/ingest/fsm.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ import (

"github.com/stellar/go/ingest"
"github.com/stellar/go/ingest/ledgerbackend"
"github.com/stellar/go/services/horizon/internal/toid"
"github.com/stellar/go/support/errors"
logpkg "github.com/stellar/go/support/log"
"github.com/stellar/go/toid"
"github.com/stellar/go/xdr"
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ import (
"github.com/stellar/go/ingest/ledgerbackend"
"github.com/stellar/go/services/horizon/internal/db2/history"
"github.com/stellar/go/services/horizon/internal/ingest/processors"
"github.com/stellar/go/services/horizon/internal/toid"
"github.com/stellar/go/support/errors"
"github.com/stellar/go/toid"
"github.com/stellar/go/xdr"
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ import (

"github.com/stellar/go/ingest"
"github.com/stellar/go/services/horizon/internal/db2/history"
"github.com/stellar/go/services/horizon/internal/toid"
"github.com/stellar/go/support/errors"
"github.com/stellar/go/toid"
"github.com/stellar/go/xdr"
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import (
"github.com/stretchr/testify/suite"

"github.com/stellar/go/services/horizon/internal/db2/history"
"github.com/stellar/go/services/horizon/internal/toid"
"github.com/stellar/go/toid"
"github.com/stellar/go/xdr"
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ import (
"github.com/stellar/go/ingest"
"github.com/stellar/go/services/horizon/internal/db2/history"
. "github.com/stellar/go/services/horizon/internal/test/transactions"
"github.com/stellar/go/services/horizon/internal/toid"
"github.com/stellar/go/support/errors"
"github.com/stellar/go/toid"
"github.com/stellar/go/xdr"
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ import (

"github.com/stellar/go/ingest"
"github.com/stellar/go/services/horizon/internal/db2/history"
"github.com/stellar/go/services/horizon/internal/toid"
"github.com/stellar/go/support/errors"
"github.com/stellar/go/toid"
"github.com/stellar/go/xdr"
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import (
"github.com/stretchr/testify/suite"

"github.com/stellar/go/services/horizon/internal/db2/history"
"github.com/stellar/go/services/horizon/internal/toid"
"github.com/stellar/go/toid"
"github.com/stellar/go/xdr"
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ import (
"github.com/stellar/go/ingest"
"github.com/stellar/go/protocols/horizon/base"
"github.com/stellar/go/services/horizon/internal/db2/history"
"github.com/stellar/go/services/horizon/internal/toid"
"github.com/stellar/go/support/errors"
"github.com/stellar/go/toid"
"github.com/stellar/go/xdr"
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,11 @@ package processors

import (
"context"

"github.com/stellar/go/ingest"
"github.com/stellar/go/services/horizon/internal/db2/history"
"github.com/stellar/go/services/horizon/internal/toid"
"github.com/stellar/go/support/errors"
"github.com/stellar/go/toid"
"github.com/stellar/go/xdr"
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ import (

"github.com/stellar/go/ingest"
"github.com/stellar/go/services/horizon/internal/db2/history"
"github.com/stellar/go/services/horizon/internal/toid"
"github.com/stellar/go/support/errors"
"github.com/stellar/go/toid"
"github.com/stellar/go/xdr"
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ import (

"github.com/stellar/go/ingest"
"github.com/stellar/go/services/horizon/internal/db2/history"
"github.com/stellar/go/services/horizon/internal/toid"
"github.com/stellar/go/support/errors"
"github.com/stellar/go/toid"
"github.com/stellar/go/xdr"
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import (

"github.com/stellar/go/ingest"
"github.com/stellar/go/services/horizon/internal/db2/history"
"github.com/stellar/go/services/horizon/internal/toid"
"github.com/stellar/go/toid"
"github.com/stellar/go/xdr"
"github.com/stretchr/testify/mock"
"github.com/stretchr/testify/suite"
Expand Down
2 changes: 1 addition & 1 deletion services/horizon/internal/reap/system.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ import (
"time"

herrors "github.com/stellar/go/services/horizon/internal/errors"
"github.com/stellar/go/services/horizon/internal/toid"
"github.com/stellar/go/support/errors"
"github.com/stellar/go/support/log"
"github.com/stellar/go/toid"
)

// DeleteUnretainedHistory removes all data associated with unretained ledgers.
Expand Down
7 changes: 2 additions & 5 deletions services/horizon/internal/toid/main.go → toid/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ import (

//
// ID represents the total order of Ledgers, Transactions and
// Operations.
// Operations. This is an implementation of SEP-35:
// https://github.com/stellar/stellar-protocol/blob/master/ecosystem/sep-0035.md
//
// Operations within the stellar network have a total order, expressed by three
// pieces of information: the ledger sequence the operation was validated in,
Expand Down Expand Up @@ -50,10 +51,6 @@ import (
// Expressed in network byte order.
//
//
// Note: API Clients should not be interpreting this value. We will use it
// as an opaque paging token that clients can parrot back to us after having read
// it within a resource to page from the represented position in time.
//
// Note: This does not uniquely identify an object. Given a ledger, it will
// share its id with its first transaction and the first operation of that
// transaction as well. Given that this ID is only meant for ordering within a
Expand Down
File renamed without changes.

0 comments on commit ae4b37a

Please sign in to comment.