Shopify / Shopify/async-memcached

Is it possible exposing async_memcached::MetaValue as public?

Open Beginner friendly
#84 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Rust
Stars
16
Forks
5
Avg merge
1d 13h
Merged PRs (30d)
2

Description

Problem

async-memcached exposes meta protocol methods through the public MetaProtocol trait, but the response value type is not nameable by downstream crates.

For example, MetaProtocol::meta_get returns:

Result<Option<MetaValue>, Error>                                                                                                                                                                      

Internally, MetaValue is defined as a public struct in parser/mod.rs:

  pub struct MetaValue {                                                                                                                                                                                
      pub key: Option<Vec<u8>>,                                                                                                                                                                         
      pub cas: Option<u64>,                                                                                                                                                                             
      pub flags: Option<u32>,                                                                                                                                                                           
      pub data: Option<Vec<u8>>,                                                                                                                                                                        
      pub status: Option<Status>,                                                                                                                                                                       
      pub hit_before: Option<bool>,                                                                                                                                                                     
      pub last_accessed: Option<u64>,                                                                                                                                                                   
      pub ttl_remaining: Option<i64>,                                                                                                                                                                   
      pub size: Option<u64>,                                                                                                                                                                            
      pub opaque_token: Option<Vec<u8>>,                                                                                                                                                                
      pub is_stale: Option<bool>,                                                                                                                                                                       
      pub is_recache_winner: Option<bool>,                                                                                                                                                              
  }                                                                                                                                                                                                     

But the crate root only re-exports:

  pub use self::parser::{                                                                                                                                                                               
      ErrorKind, KeyMetadata, MetadumpResponse, Response, StatsResponse, Status, Value,                                                                                                                 
  };                                                                                                                                                                                                    

So downstream users cannot write:

  async_memcached::MetaValue                                                                                                                                                                            

or name the return type in wrapper/helper APIs.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in parser/mod.rs to confirm MetaValue is already public, then inspect the crate-root re-exports shown in the issue. Expose MetaValue there so downstream crates can refer to async_memcached::MetaValue and name the MetaProtocol::meta_get return type. Done when the public type is available through the crate root without changing its fields.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
api
Issue type
Feature
Difficulty
1/5
Estimated time
Under an hour
Activity status
Quiet
Clarity
Clearly specified
Newbie friendliness
90/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.