Skip to content

Conversation

@carlsverre
Copy link
Contributor

Which issue does this PR close?

Closes #7035.

Rationale for this change

This makes the Memory service more of a drop-in replacement for other stores. I need this for testing in my project.

What changes are included in this PR?

The if_not_exists capability was added to the Memory service.

Are there any user-facing changes?

The Memory store now supports the if_not_exists capability.

AI Usage Statement

No AI was used in writing this code.

Copilot AI review requested due to automatic review settings December 16, 2025 20:33
@carlsverre carlsverre requested a review from Xuanwo as a code owner December 16, 2025 20:33
@dosubot dosubot bot added size:S This PR changes 10-29 lines, ignoring generated files. releases-note/feat The PR implements a new feature or has a title that begins with "feat" labels Dec 16, 2025
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR adds support for the if_not_exists write capability to the Memory service, making it more compatible with other storage services. This is useful for testing scenarios where conditional writes are required.

  • Implements set_if_not_exists method in MemoryCore using atomic Entry API
  • Updates MemoryWriter to conditionally use the new method based on operation flags
  • Declares the write_with_if_not_exists capability in MemoryBackend

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.

File Description
core/core/src/services/memory/backend.rs Declares write_with_if_not_exists: true capability
core/core/src/services/memory/core.rs Adds thread-safe set_if_not_exists method with atomic check-and-insert logic
core/core/src/services/memory/writer.rs Routes write operations to set_if_not_exists when the flag is set

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@Xuanwo Xuanwo changed the title support if_not_exists in the Memory service feat: support if_not_exists in the Memory service Dec 17, 2025
Copy link
Member

@Xuanwo Xuanwo left a comment

Choose a reason for hiding this comment

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

Love this idea!

@dosubot dosubot bot added the lgtm This PR has been approved by a maintainer label Dec 17, 2025
@Xuanwo Xuanwo merged commit fdf3036 into apache:main Dec 17, 2025
330 checks passed
jcarey9149 pushed a commit to jcarey9149/opendal that referenced this pull request Dec 18, 2025
support if_not_exists in the Memory service
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

lgtm This PR has been approved by a maintainer releases-note/feat The PR implements a new feature or has a title that begins with "feat" size:S This PR changes 10-29 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

new feature: support if_not_exists in the Memory service

2 participants