Skip to content

BucketId info Reader#143

Open
AshayKing wants to merge 9 commits intosantanusinha:masterfrom
AshayKing:bucketid-getter
Open

BucketId info Reader#143
AshayKing wants to merge 9 commits intosantanusinha:masterfrom
AshayKing:bucketid-getter

Conversation

@AshayKing
Copy link
Copy Markdown
Contributor

No description provided.


@Builder
@Getter
public class BucketKeyInfo {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

rename to BucketInfo

@Builder
@Getter
public class BucketKeyInfo {
private int value;
Copy link
Copy Markdown
Contributor

@shivangi219 shivangi219 Mar 15, 2026

Choose a reason for hiding this comment

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

we should give key also in response.

import java.util.Map;
import java.util.Objects;

public class BucketKeyReader<T> {
Copy link
Copy Markdown
Contributor

@shivangi219 shivangi219 Mar 15, 2026

Choose a reason for hiding this comment

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

rename to BucketResolver

this.initialisedEntitiesMeta = initialisedEntitiesMeta;
}

public <U> BucketKeyInfo getBucketId(final String tenantId,
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

getBucketInfo

return null;
}

if (Objects.isNull(bucketIdExtractor)) {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

this is already checked during initialization

final var shardingKeyFieldEntry = fetchAndValidateAnnotateField(clazz, ShardingKey.class, String.class);
final var shardingKeyField = shardingKeyFieldEntry.map(Map.Entry::getKey);
final var lookupKeyField = lookupKeyFieldEntry.map(Map.Entry::getKey);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

rename these to shardingKeyFieldOptional and lookupKeyFieldOptional

final var shardingKeyFieldDeclaringClassLookup =
MethodHandles.privateLookupIn(shardingKeyFieldEntry.get().getValue(), MethodHandles.lookup());
shardingKeyGetter = shardingKeyFieldDeclaringClassLookup.unreflectGetter(shardingKeyField.get());
final var shardingKeyFieldData = shardingKeyField.get();
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

rename to shardingKeyField and lookupKeyFiel

Thread.currentThread().interrupt();
}
}
});
Copy link
Copy Markdown
Contributor

@shivangi219 shivangi219 Mar 15, 2026

Choose a reason for hiding this comment

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

registerBucketIdExtractor should be here, once all tenants are initialised

return Collections.unmodifiableMap(this.initialisedEntitiesMeta);
}

public BucketKeyReader<String> getBucketKeyReader() {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

should this be public?

@sonarqubecloud
Copy link
Copy Markdown

sonarqubecloud bot commented Apr 7, 2026

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